From 806e24138b407375974e5068257403ca82c7c8eb Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 21 Aug 2023 16:16:13 +0200 Subject: [PATCH] LanguageClient: send out empty workspace configurations ... instead of an error when the server asks for the configuration even if we do not provide a way to configure workspace configurations yet. Change-Id: I0d330b47a12627af100bf9d9b1eec34a58d6471b Reviewed-by: Christian Stenger --- src/libs/languageserverprotocol/workspace.h | 4 ++-- src/plugins/languageclient/client.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/libs/languageserverprotocol/workspace.h b/src/libs/languageserverprotocol/workspace.h index 69c3ef9bd4f..703310caaa3 100644 --- a/src/libs/languageserverprotocol/workspace.h +++ b/src/libs/languageserverprotocol/workspace.h @@ -109,8 +109,8 @@ public: bool isValid() const override { return contains(itemsKey); } }; -class LANGUAGESERVERPROTOCOL_EXPORT ConfigurationRequest : public Request< - LanguageClientArray, std::nullptr_t, ConfigurationParams> +class LANGUAGESERVERPROTOCOL_EXPORT ConfigurationRequest + : public Request { public: explicit ConfigurationRequest(const ConfigurationParams ¶ms); diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index 7e41452b2c6..1d18b0b189d 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -1941,6 +1941,18 @@ void ClientPrivate::handleMethod(const QString &method, const MessageId &id, con if (ProgressManager::isProgressEndMessage(*params)) emit q->workDone(params->token()); } + } else if (method == ConfigurationRequest::methodName) { + ConfigurationRequest::Response response; + QJsonArray result; + if (QTC_GUARD(id.isValid())) + response.setId(id); + ConfigurationRequest configurationRequest(message.toJsonObject()); + if (auto params = configurationRequest.params()) { + for (int i = 0, end = params->items().count(); i < end; ++i) + result.append({}); + } + response.setResult(result); + sendResponse(response); } else if (isRequest) { Response response(id); ResponseError error;