clangd: Add ability to change --limit-results

A user can set a value to the QTC_CLANGD_COMPLETION_RESULTS
environment variable which will be passed as argument to clangd's
--limit-results.

The clangd default value is 100.

Task-number: QTCREATORBUG-27152
Change-Id: Ic3e512a735fda1540b4f0ab56e39f9c5f0213e79
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Cristian Adam
2022-07-26 16:23:00 +02:00
parent 5b72ecbff7
commit 230b98ce76

View File

@@ -273,8 +273,13 @@ static BaseClientInterface *clientInterface(Project *project, const Utils::FileP
indexingOption += "=0";
const QString headerInsertionOption = QString("--header-insertion=")
+ (settings.autoIncludeHeaders() ? "iwyu" : "never");
bool ok = false;
const int userValue = qEnvironmentVariableIntValue("QTC_CLANGD_COMPLETION_RESULTS", &ok);
const QString limitResults = QString("--limit-results=%1").arg(ok ? userValue : 0);
Utils::CommandLine cmd{settings.clangdFilePath(), {indexingOption, headerInsertionOption,
"--limit-results=0", "--limit-references=0", "--clang-tidy=0"}};
limitResults, "--limit-references=0", "--clang-tidy=0"}};
if (settings.workerThreadLimit() != 0)
cmd.addArg("-j=" + QString::number(settings.workerThreadLimit()));
if (!jsonDbDir.isEmpty())