Clangd: Allow to switch off background indexing

It is conceivable that users don't want to spend the extra CPU time on
this.

Change-Id: Ic3611c8d17d201ae986fad08b344369a8728ce1b
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-06-25 17:40:20 +02:00
parent ba138a1855
commit 876cd8e975
4 changed files with 23 additions and 2 deletions

View File

@@ -382,8 +382,11 @@ public:
static BaseClientInterface *clientInterface(const Utils::FilePath &jsonDbDir)
{
QString indexingOption = "--background-index";
if (!CppTools::ClangdSettings::indexingEnabled())
indexingOption += "=0";
Utils::CommandLine cmd{CppTools::ClangdSettings::clangdFilePath(),
{"--background-index", "--limit-results=0"}};
{indexingOption, "--limit-results=0"}};
if (!jsonDbDir.isEmpty())
cmd.addArg("--compile-commands-dir=" + jsonDbDir.toString());
if (clangdLog().isDebugEnabled())