From 9102452272767f652f4db9862b5b64c96887a1a0 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Mon, 22 Aug 2022 15:46:21 +0200 Subject: [PATCH] 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 Reviewed-by: Eike Ziller --- src/plugins/clangcodemodel/clangdclient.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 9e828900a7c..228126ef215 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -82,6 +82,7 @@ #include #include #include +#include #include #include #include @@ -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,