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)
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)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits