diff options
Diffstat (limited to 'clang-tools-extra/clangd/Protocol.h')
| -rw-r--r-- | clang-tools-extra/clangd/Protocol.h | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h index 079873e61cf..30352494c71 100644 --- a/clang-tools-extra/clangd/Protocol.h +++ b/clang-tools-extra/clangd/Protocol.h @@ -355,25 +355,26 @@ struct ClangdCompileCommand { }; bool fromJSON(const llvm::json::Value &, ClangdCompileCommand &); -/// Clangd extension to set clangd-specific "initializationOptions" in the -/// "initialize" request and for the "workspace/didChangeConfiguration" -/// notification since the data received is described as 'any' type in LSP. -struct ClangdConfigurationParamsChange { - // The changes that happened to the compilation database. +/// Clangd extension: parameters configurable at any time, via the +/// `workspace/didChangeConfiguration` notification. +/// LSP defines this type as `any`. +struct ConfigurationSettings { + // Changes to the in-memory compilation database. // The key of the map is a file name. - llvm::Optional<std::map<std::string, ClangdCompileCommand>> - compilationDatabaseChanges; + std::map<std::string, ClangdCompileCommand> compilationDatabaseChanges; }; -bool fromJSON(const llvm::json::Value &, ClangdConfigurationParamsChange &); +bool fromJSON(const llvm::json::Value &, ConfigurationSettings &); -struct ClangdInitializationOptions { +/// Clangd extension: parameters configurable at `initialize` time. +/// LSP defines this type as `any`. +struct InitializationOptions { // What we can change throught the didChangeConfiguration request, we can // also set through the initialize request (initializationOptions field). - ClangdConfigurationParamsChange ParamsChange; + ConfigurationSettings ConfigSettings; llvm::Optional<std::string> compilationDatabasePath; }; -bool fromJSON(const llvm::json::Value &, ClangdInitializationOptions &); +bool fromJSON(const llvm::json::Value &, InitializationOptions &); struct InitializeParams { /// The process Id of the parent process that started @@ -402,9 +403,8 @@ struct InitializeParams { /// The initial trace setting. If omitted trace is disabled ('off'). llvm::Optional<TraceLevel> trace; - // We use this predefined struct because it is easier to use - // than the protocol specified type of 'any'. - llvm::Optional<ClangdInitializationOptions> initializationOptions; + /// User-provided initialization options. + InitializationOptions initializationOptions; }; bool fromJSON(const llvm::json::Value &, InitializeParams &); @@ -477,9 +477,7 @@ struct DidChangeWatchedFilesParams { bool fromJSON(const llvm::json::Value &, DidChangeWatchedFilesParams &); struct DidChangeConfigurationParams { - // We use this predefined struct because it is easier to use - // than the protocol specified type of 'any'. - ClangdConfigurationParamsChange settings; + ConfigurationSettings settings; }; bool fromJSON(const llvm::json::Value &, DidChangeConfigurationParams &); |

