diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index a241d1c63e5..8a8fc4ccc8b 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -1676,8 +1676,10 @@ void ClangdClient::handleDiagnostics(const PublishDiagnosticsParams ¶ms) const ClangdDiagnostic clangdDiagnostic(diagnostic); const auto codeActions = clangdDiagnostic.codeActions(); if (codeActions && !codeActions->isEmpty()) { - for (const CodeAction &action : *codeActions) + for (CodeAction action : *codeActions) { + action.setDiagnostics({diagnostic}); LanguageClient::updateCodeActionRefactoringMarker(this, action, uri); + } } else { // We know that there's only one kind of diagnostic for which clangd has // a quickfix tweak, so let's not be wasteful.