clangd: use QTC_CLANGD_COMPLETION_RESULTS as default value

If the user set the QTC_CLANGD_COMPLETION_RESULTS environment variable,
use that value as the default value for the settings page widget value.

Change-Id: I525e8bb4a5631b7d8461f18d1fc5c6972bd758cb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Cristian Adam
2022-08-02 16:05:08 +02:00
parent 8a44294821
commit de08f08a21
2 changed files with 12 additions and 4 deletions

View File

@@ -508,7 +508,15 @@ void ClangdSettings::Data::fromMap(const QVariantMap &map)
diagnosticConfigId = Id::fromSetting(map.value(diagnosticConfigIdKey(),
initialClangDiagnosticConfigId().toSetting()));
haveCheckedHardwareReqirements = map.value(checkedHardwareKey(), false).toBool();
completionResults = map.value(completionResultsKey(), kDefaultCompletionResults).toInt();
completionResults = map.value(completionResultsKey(), defaultCompletionResults()).toInt();
}
int ClangdSettings::Data::defaultCompletionResults()
{
// Default clangd --limit-results value is 100
bool ok = false;
const int userValue = qEnvironmentVariableIntValue("QTC_CLANGD_COMPLETION_RESULTS", &ok);
return ok ? userValue : 100;
}
} // namespace CppEditor