diff options
author | David Schulz <david.schulz@qt.io> | 2023-09-15 14:10:08 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2023-09-15 13:09:09 +0000 |
commit | 85cba79cd265788f75a0af000bb9a39a4c2f8597 (patch) | |
tree | 165841e972f991131580f22cb20fdd30880a56d3 | |
parent | b9191e9d150ed0b7f20f281a64d213eb66a1de9b (diff) |
ClangCodeModel: fix setting refactoring markers for clangd
LanguageClient::updateCodeActionRefactoringMarker overwrites previously
set refactoring markers.
Fixes: QTCREATORBUG-29493
Change-Id: I156b4e2ff65aed5928251bfea184e093df686818
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/plugins/clangcodemodel/clangdclient.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 7c40086f09..6827471eb2 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -628,13 +628,14 @@ void ClangdClient::handleDiagnostics(const PublishDiagnosticsParams ¶ms) const int docVersion = documentVersion(uri); if (params.version().value_or(docVersion) != docVersion) return; + QList<CodeAction> allCodeActions; for (const Diagnostic &diagnostic : params.diagnostics()) { const ClangdDiagnostic clangdDiagnostic(diagnostic); auto codeActions = clangdDiagnostic.codeActions(); if (codeActions && !codeActions->isEmpty()) { for (CodeAction &action : *codeActions) action.setDiagnostics({diagnostic}); - LanguageClient::updateCodeActionRefactoringMarker(this, *codeActions, uri); + allCodeActions << *codeActions; } else { // We know that there's only one kind of diagnostic for which clangd has // a quickfix tweak, so let's not be wasteful. @@ -644,6 +645,8 @@ void ClangdClient::handleDiagnostics(const PublishDiagnosticsParams ¶ms) requestCodeActions(uri, diagnostic); } } + if (!allCodeActions.isEmpty()) + LanguageClient::updateCodeActionRefactoringMarker(this, allCodeActions, uri); } void ClangdClient::handleDocumentOpened(TextDocument *doc) |