LSP: Fix CodeActionResult

The isValid check now works on both objects since the error message
simplification. So check the command property and see whether it is a
string to identify the object.

Change-Id: Iaafe2d868267ebb83440d72703ee3edc517385d8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2021-06-04 10:00:42 +02:00
parent ac2271a9cb
commit 93fcf5c91f

View File

@@ -353,11 +353,15 @@ CodeActionResult::CodeActionResult(const QJsonValue &val)
const QJsonArray array = val.toArray();
ResultArray result;
for (const QJsonValue &val : array) {
Command command(val);
if (val.toObject().value(commandKey).isString()) {
const Command command(val);
if (command.isValid())
result << command;
else
result << CodeAction(val);
} else {
const CodeAction action(val);
if (action.isValid())
result << action;
}
}
emplace<ResultArray>(result);
return;