[PATCH] D94222: [clangd] Add server capability advertising hot-reloading of CDBs.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 7 02:40:51 PST 2021
sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.
Currently some clients watch for CDB changes and restart clangd, now that we
can reload compile_commands.json ourselves this is counterproductive.
The capability allows this behavior to be phased out.
This is going to be a mild regression, as we do not actually watch for files on
disk and so new diagnostics need to wait until a rebuild is requested e.g. due
to file change (and the internal caches have expired).
However this is still a better tradeoff (and if it's important, we can request
the client to watch files for us in the future).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94222
Files:
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/test/initialize-params.test
Index: clang-tools-extra/clangd/test/initialize-params.test
===================================================================
--- clang-tools-extra/clangd/test/initialize-params.test
+++ clang-tools-extra/clangd/test/initialize-params.test
@@ -8,6 +8,9 @@
# CHECK-NEXT: "astProvider": true,
# CHECK-NEXT: "callHierarchyProvider": true,
# CHECK-NEXT: "codeActionProvider": true,
+# CHECK-NEXT: "compilationDatabase": {
+# CHECK-NEXT: "automaticReload": true
+# CHECK-NEXT: },
# CHECK-NEXT: "completionProvider": {
# CHECK-NEXT: "allCommitCharacters": [
# CHECK-NEXT: " ",
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===================================================================
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -620,7 +620,7 @@
{"documentSymbolProvider", true},
{"workspaceSymbolProvider", true},
{"referencesProvider", true},
- {"astProvider", true},
+ {"astProvider", true}, // clangd extension
{"executeCommandProvider",
llvm::json::Object{
{"commands",
@@ -628,7 +628,9 @@
ExecuteCommandParams::CLANGD_APPLY_TWEAK}},
}},
{"typeHierarchyProvider", true},
- {"memoryUsageProvider", true}, // clangd extension.
+ {"memoryUsageProvider", true}, // clangd extension
+ {"compilationDatabase", // clangd extension
+ llvm::json::Object{{"automaticReload", true}}},
{"callHierarchyProvider", true},
}}}};
if (Opts.Encoding)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94222.315076.patch
Type: text/x-patch
Size: 1691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210107/2dd6c043/attachment.bin>
More information about the cfe-commits
mailing list