forked from qt-creator/qt-creator
ClangCodeModel: Fix handling of code actions in diagnostic tooltip
We need to create a sub-diagnostic for every clangd code action. Task-number: QTCREATORBUG-27514 Change-Id: I9a12bcb390c9cc157ba7bca5015bbf51d31263da Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -266,12 +266,15 @@ ClangDiagnostic convertDiagnostic(const ClangdDiagnostic &src, const FilePath &f
|
||||
const Utils::optional<WorkspaceEdit::Changes> changes = edit->changes();
|
||||
if (!changes)
|
||||
continue;
|
||||
ClangDiagnostic fixItDiag;
|
||||
fixItDiag.text = codeAction.title();
|
||||
for (auto it = changes->cbegin(); it != changes->cend(); ++it) {
|
||||
for (const TextEdit &textEdit : it.value()) {
|
||||
target.fixIts << ClangFixIt(textEdit.newText(),
|
||||
fixItDiag.fixIts << ClangFixIt(textEdit.newText(),
|
||||
convertRange(it.key().toFilePath(), textEdit.range()));
|
||||
}
|
||||
}
|
||||
target.children << fixItDiag;
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user