diff options
author | Alex Lorenz <arphaman@gmail.com> | 2018-08-01 17:39:29 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2018-08-01 17:39:29 +0000 |
commit | f808786a6543b7a00e3b51da5b27ce57fce0db6f (patch) | |
tree | 1b040d6330e0d24b4c23f21e5c7f22d44c4a9827 /clang-tools-extra/clangd/Protocol.cpp | |
parent | f6d1923c8640c7931c51a7b8254663c23835924e (diff) | |
download | bcm5719-llvm-f808786a6543b7a00e3b51da5b27ce57fce0db6f.tar.gz bcm5719-llvm-f808786a6543b7a00e3b51da5b27ce57fce0db6f.zip |
[clangd] allow clients to control the compilation database by passing in
compilationDatabaseChanges in the 'workspace/didChangeConfiguration' request
This commit allows clangd to use an in-memory compilation database that's
controlled from the LSP client (-compile_args_from=lsp). It extends the
'workspace/didChangeConfiguration' request to allow the client to pass in a
compilation database subset that needs to be updated in the workspace.
Differential Revision: https://reviews.llvm.org/D49758
llvm-svn: 338597
Diffstat (limited to 'clang-tools-extra/clangd/Protocol.cpp')
-rw-r--r-- | clang-tools-extra/clangd/Protocol.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp index 5ecd7195c07..202fbfb08e0 100644 --- a/clang-tools-extra/clangd/Protocol.cpp +++ b/clang-tools-extra/clangd/Protocol.cpp @@ -591,10 +591,18 @@ bool fromJSON(const json::Value &Params, DidChangeConfigurationParams &CCP) { return O && O.map("settings", CCP.settings); } +bool fromJSON(const llvm::json::Value &Params, + ClangdCompileCommand &CDbUpdate) { + json::ObjectMapper O(Params); + return O && O.map("workingDirectory", CDbUpdate.workingDirectory) && + O.map("compilationCommand", CDbUpdate.compilationCommand); +} + bool fromJSON(const json::Value &Params, ClangdConfigurationParamsChange &CCPC) { json::ObjectMapper O(Params); - return O && O.map("compilationDatabasePath", CCPC.compilationDatabasePath); + return O && O.map("compilationDatabasePath", CCPC.compilationDatabasePath) && + O.map("compilationDatabaseChanges", CCPC.compilationDatabaseChanges); } } // namespace clangd |