diff options
author | Cristian Adam <cristian.adam@qt.io> | 2022-08-22 15:46:21 +0200 |
---|---|---|
committer | Cristian Adam <cristian.adam@qt.io> | 2022-08-23 13:41:11 +0000 |
commit | 9102452272767f652f4db9862b5b64c96887a1a0 (patch) | |
tree | 707428d6393f32f9028bd8e92a0570ef2a83450a | |
parent | 6a3933c87aad49c17c3dfb35edda0018863998ca (diff) | |
download | qt-creator-9102452272767f652f4db9862b5b64c96887a1a0.tar.gz |
clangd: Use QtC system environment for environment variables
Users would set QTC_CLANGD_COMPLETION_RESULTS in the Qt Creator
system environment variable dialog and expect that clangd would
the be configured with the corresponding --limit-results value.
Task-number: QTCREATORBUG-28071
Change-Id: Ia7a9b6a96fabe7ba16906c547a15716f0b83f0ec
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | src/plugins/clangcodemodel/clangdclient.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 9e828900a7..228126ef21 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -82,6 +82,7 @@ #include <texteditor/texteditorsettings.h> #include <texteditor/texteditor.h> #include <utils/algorithm.h> +#include <utils/environment.h> #include <utils/fileutils.h> #include <utils/itemviews.h> #include <utils/runextensions.h> @@ -275,7 +276,8 @@ static BaseClientInterface *clientInterface(Project *project, const Utils::FileP + (settings.autoIncludeHeaders() ? "iwyu" : "never"); bool ok = false; - const int userValue = qEnvironmentVariableIntValue("QTC_CLANGD_COMPLETION_RESULTS", &ok); + const int userValue + = Utils::Environment::systemEnvironment().value("QTC_CLANGD_COMPLETION_RESULTS").toInt(&ok); const QString limitResults = QString("--limit-results=%1").arg(ok ? userValue : 0); Utils::CommandLine cmd{settings.clangdFilePath(), {indexingOption, headerInsertionOption, |