LanguageClient: Improve refactoring markers

Clicking the lightbulb should bring up a menu if and only if there is
more than one possible action for this location.
Amends 089e1edcbf.

Change-Id: I45348ed4fbf9b3f32e19bbe17f0c2c030ecd24ed
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-05-17 12:34:00 +02:00
parent 54d4c4db62
commit 5d615e916f
4 changed files with 52 additions and 39 deletions

View File

@@ -955,13 +955,14 @@ void Client::handleCodeActionResponse(const CodeActionRequest::Response &respons
log(*error);
if (const Utils::optional<CodeActionResult> &result = response.result()) {
if (auto list = Utils::get_if<QList<Utils::variant<Command, CodeAction>>>(&*result)) {
QList<CodeAction> codeActions;
for (const Utils::variant<Command, CodeAction> &item : *list) {
if (auto action = Utils::get_if<CodeAction>(&item))
updateCodeActionRefactoringMarker(this, *action, uri);
else if (auto command = Utils::get_if<Command>(&item)) {
codeActions << *action;
else if (auto command = Utils::get_if<Command>(&item))
Q_UNUSED(command) // todo
}
}
updateCodeActionRefactoringMarker(this, codeActions, uri);
}
}
}