forked from qt-creator/qt-creator
ClangCodeModel: Fix positioning lightbulbs for diagnostics
Set the diagnostic to the containing code action when generating refactor markers. This makes sure the light bulb is displayed at the diagnostic and not the edit location. Change-Id: I46ac7a19879d2358eb49f5cb1b695ee10a0c682d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user