Clangd: Let users limit the worker thread count

This is particularly interesting for indexing, where users might prefer
a slower-building index with less CPU load.

Change-Id: Id44c58e9041df2857cd0772e71345673b14623f3
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-06-25 18:16:08 +02:00
parent 876cd8e975
commit 56cddf38b3
4 changed files with 28 additions and 3 deletions

View File

@@ -387,6 +387,8 @@ static BaseClientInterface *clientInterface(const Utils::FilePath &jsonDbDir)
indexingOption += "=0";
Utils::CommandLine cmd{CppTools::ClangdSettings::clangdFilePath(),
{indexingOption, "--limit-results=0"}};
if (CppTools::ClangdSettings::workerThreadLimit() != 0)
cmd.addArg("-j=" + QString::number(CppTools::ClangdSettings::workerThreadLimit()));
if (!jsonDbDir.isEmpty())
cmd.addArg("--compile-commands-dir=" + jsonDbDir.toString());
if (clangdLog().isDebugEnabled())