[clangd] Why do the `$/initialize` and `workspace/didChangeConfiguration` methods parameters differ?
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
The `$/initialize` method accepts the following parameters:
```cpp
struct InitializeParams {
// ... snip ...
InitializationOptions initializationOptions;
// ... snip ...
};
/// The struct InitializationOptions is:
struct InitializationOptions {
ConfigurationSettings ConfigSettings;
std::optional compilationDatabasePath;
std::vector fallbackFlags;
bool FileStatus = false;
};
```
While the `workspace/didChangeConfiguration` method accepts the following:
```cpp
struct DidChangeConfigurationParams {
ConfigurationSettings settings;
};
```
And they are both used similarly in the LSP implementation:
```cpp
void ClangdLSPServer::onInitialize(const InitializeParams &Params,
Callback Reply) {
// ... snip ...
// Apply settings after we're fully initialized.
// This can start background indexing and in turn trigger LSP notifications.
applyConfiguration(Params.initializationOptions.ConfigSettings);
}
// ... snip ...
// FIXME: This function needs to be properly tested.
void ClangdLSPServer::onChangeConfiguration(
const DidChangeConfigurationParams &Params) {
applyConfiguration(Params.settings);
}
```
Why are does the re-configuration method only accept a subset of the parameters of the initialization method? I could understand if the `FileStatus` boolean or the `fallbackFlags` list required a restart or cache eviction of the loaded `clangd` configuration/opened files, but surely the `didChangeConfiguration` method could accept a new `compilationDatabasePath`, no?
As I'm mainly using Neovim, I would like if I could simply provide the path to `compile_commands.json` using that field and leave `clangd` do the parsing, instead of doing it myself to provide it to `clangd`.
Contributor guide
Assessment
This issue has not been assessed yet.