From 93fcf5c91f4143262a4c1aee6a5b752bb85f23c3 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 4 Jun 2021 10:00:42 +0200 Subject: [PATCH] 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 --- .../languageserverprotocol/languagefeatures.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libs/languageserverprotocol/languagefeatures.cpp b/src/libs/languageserverprotocol/languagefeatures.cpp index 0d32fbcae05..59fb9688b78 100644 --- a/src/libs/languageserverprotocol/languagefeatures.cpp +++ b/src/libs/languageserverprotocol/languagefeatures.cpp @@ -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 (command.isValid()) - result << command; - else - result << CodeAction(val); + if (val.toObject().value(commandKey).isString()) { + const Command command(val); + if (command.isValid()) + result << command; + } else { + const CodeAction action(val); + if (action.isValid()) + result << action; + } } emplace(result); return;