CppEditor: Make check for clangd more fine-grained

... in the quickfix factories.
We want to be able to offer or not offer certain quickfixes based on the
current clangd version.

Change-Id: I7dca69ff990ab9f1a691785cd72e633f7882ae3d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Christian Kandeler
2024-02-20 16:23:25 +01:00
parent b9e4c98f1d
commit 5956254e6f
11 changed files with 36 additions and 17 deletions

View File

@@ -428,9 +428,12 @@ void ClangModelManagerSupport::checkUnused(const Link &link, SearchResult *searc
CppModelManager::Backend::Builtin)->checkUnused(link, search, callback);
}
bool ClangModelManagerSupport::usesClangd(const TextEditor::TextDocument *document) const
std::optional<QVersionNumber> ClangModelManagerSupport::usesClangd(
const TextEditor::TextDocument *document) const
{
return clientForFile(document->filePath());
if (const auto client = clientForFile(document->filePath()))
return client->versionNumber();
return {};
}
BaseEditorDocumentProcessor *ClangModelManagerSupport::createEditorDocumentProcessor(

View File

@@ -42,7 +42,7 @@ public:
CppEditor::BaseEditorDocumentProcessor *createEditorDocumentProcessor(
TextEditor::TextDocument *baseTextDocument) override;
bool usesClangd(const TextEditor::TextDocument *document) const override;
std::optional<QVersionNumber> usesClangd(const TextEditor::TextDocument *document) const override;
static QList<LanguageClient::Client *> clientsForOpenProjects();
static ClangdClient *clientForProject(const ProjectExplorer::Project *project);