https://github.com/sr-tream created https://github.com/llvm/llvm-project/pull/72635
Currently, impossible to remove irrelevant files from CDB via LSP notification `workspace/didChangeConfiguration`. This PR change clangd behavior to remove file from CDB, when LSP pass empty parameters for them. >From 587dbb0a2329a0fe06894271405acae5f03bbd7d Mon Sep 17 00:00:00 2001 From: SR_team <m...@sr.team> Date: Fri, 17 Nov 2023 11:58:13 +0200 Subject: [PATCH] Add way to remove file from CDB via LSP --- clang-tools-extra/clangd/ClangdLSPServer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp index a87da252b7a7e9b..0a228df4f0b5f4c 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.cpp +++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -1385,7 +1385,10 @@ void ClangdLSPServer::applyConfiguration( std::move(Entry.second.compilationCommand), /*Output=*/""); if (Old != New) { - CDB->setCompileCommand(File, std::move(New)); + if (New.CommandLine.empty() && New.Directory.empty()) + CDB->setCompileCommand(File, std::nullopt); + else + CDB->setCompileCommand(File, std::move(New)); ModifiedFiles.insert(File); } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits