[clang-tools-extra] [clangd] Make clangd-indexer respect .clangd configuration files (PR #214951)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 24 16:50:29 PDT 2026
================
@@ -152,6 +201,16 @@ int main(int argc, const char **argv) {
return 1;
}
+ clang::clangd::RealThreadsafeFS TFS;
+ std::vector<std::unique_ptr<clang::clangd::config::Provider>> ProviderStack;
+ if (clang::clangd::EnableConfig)
+ ProviderStack =
+ clang::clangd::config::Provider::createDefaultProviders(TFS);
+ auto ConfigProvider =
+ clang::clangd::config::Provider::combine(std::move(ProviderStack));
+ auto ContextProvider =
+ clang::clangd::createConfiguredContextProvider(ConfigProvider.get());
----------------
HighCommander4 wrote:
Looking at this again, I realized that printing the config diagnostics to the command line is exactly the behaviour that `ClangdServer::createConfiguredContextProvider` degrades to if passed a null `Callbacks` (since it prints them [here](https://searchfox.org/llvm/rev/c4048fb6de5097256045212f9f80c5f0ab41deed/clang-tools-extra/clangd/ClangdServer.cpp#399-400), and that code is reached even if `Callbacks` is null; only [this part](https://searchfox.org/llvm/rev/c4048fb6de5097256045212f9f80c5f0ab41deed/clang-tools-extra/clangd/ClangdServer.cpp#413-414) is skipped).
So in fact we can just use `ClangdServer::createConfiguredContextProvider` with a null callback and it will be equivalent.
Sorry for overlooking this before and asking you to change this, my bad :/
https://github.com/llvm/llvm-project/pull/214951
More information about the cfe-commits
mailing list