forked from qt-creator/qt-creator
CppEditor: Do not use clangd < 13
We will shortly need to use a command-line option that is new in clangd 13. Rather than starting to add checks for versions that won't work as expected anyway, we simply refuse to use clangd < 13 now. Change-Id: I42ec679e0f58449a2593cf92b4be7ed3101fa787 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -35,7 +35,6 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/infolabel.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QSpinBox>
|
||||
@@ -285,30 +284,14 @@ ClangdSettingsWidget::ClangdSettingsWidget(const ClangdSettings::Data &settingsD
|
||||
if (!d->clangdChooser.isValid())
|
||||
return;
|
||||
const Utils::FilePath clangdPath = d->clangdChooser.filePath();
|
||||
Utils::QtcProcess clangdProc;
|
||||
clangdProc.setCommand({clangdPath, {"--version"}});
|
||||
clangdProc.start();
|
||||
if (!clangdProc.waitForStarted() || !clangdProc.waitForFinished()) {
|
||||
labelSetter.setWarning(tr("Failed to retrieve clangd version: %1")
|
||||
.arg(clangdProc.exitMessage()));
|
||||
return;
|
||||
}
|
||||
const QString output = clangdProc.allOutput();
|
||||
static const QString versionPrefix = "clangd version ";
|
||||
const int prefixOffset = output.indexOf(versionPrefix);
|
||||
QVersionNumber clangdVersion;
|
||||
if (prefixOffset != -1) {
|
||||
clangdVersion = QVersionNumber::fromString(output.mid(prefixOffset
|
||||
+ versionPrefix.length()));
|
||||
}
|
||||
const QVersionNumber clangdVersion = ClangdSettings::clangdVersion(clangdPath);
|
||||
if (clangdVersion.isNull()) {
|
||||
labelSetter.setWarning(tr("Failed to retrieve clangd version: "
|
||||
"Unexpected clangd output."));
|
||||
return;
|
||||
}
|
||||
if (clangdVersion < QVersionNumber(13)) {
|
||||
labelSetter.setWarning(tr("The clangd version is %1, but %2 or greater is "
|
||||
"recommended for full functionality.")
|
||||
labelSetter.setWarning(tr("The clangd version is %1, but %2 or greater is required.")
|
||||
.arg(clangdVersion.toString()).arg(13));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user