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 <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2023-08-21 16:16:13 +02:00
parent 45e3fa1621
commit 806e24138b
2 changed files with 14 additions and 2 deletions

View File

@@ -109,8 +109,8 @@ public:
bool isValid() const override { return contains(itemsKey); } bool isValid() const override { return contains(itemsKey); }
}; };
class LANGUAGESERVERPROTOCOL_EXPORT ConfigurationRequest : public Request< class LANGUAGESERVERPROTOCOL_EXPORT ConfigurationRequest
LanguageClientArray<QJsonValue>, std::nullptr_t, ConfigurationParams> : public Request<QJsonArray, std::nullptr_t, ConfigurationParams>
{ {
public: public:
explicit ConfigurationRequest(const ConfigurationParams &params); explicit ConfigurationRequest(const ConfigurationParams &params);

View File

@@ -1941,6 +1941,18 @@ void ClientPrivate::handleMethod(const QString &method, const MessageId &id, con
if (ProgressManager::isProgressEndMessage(*params)) if (ProgressManager::isProgressEndMessage(*params))
emit q->workDone(params->token()); 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) { } else if (isRequest) {
Response<JsonObject, JsonObject> response(id); Response<JsonObject, JsonObject> response(id);
ResponseError<JsonObject> error; ResponseError<JsonObject> error;