clangd: make --limit-results configurable in Preferences

The default value is the clangd default value: 100.

Fixes: QTCREATORBUG-27152
Change-Id: Icb6c67645b33325da591cb360c17b3dd55fc60ad
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-25 17:04:23 +02:00
parent 44f1fd6498
commit 86b8f68f78
4 changed files with 33 additions and 2 deletions

View File

@@ -262,8 +262,16 @@ static BaseClientInterface *clientInterface(Project *project, const Utils::FileP
indexingOption += "=0";
const QString headerInsertionOption = QString("--header-insertion=")
+ (settings.autoIncludeHeaders() ? "iwyu" : "never");
#ifdef WITH_TESTS
// For the #include < test, which needs to get a local header file, but the list
// is being flooded with system include headers. 4280 on Windows!
const QString limitResults = QString("--limit-results=0");
#else
const QString limitResults = QString("--limit-results=%1").arg(settings.completionResults());
#endif
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())