forked from qt-creator/qt-creator
LSP: update colorProvider entry of ServerCapabilities
Since version 3.8.0 of the lsp the server can provide the information whether it supports colors also via an boolean value. The newly added ColorProviderOptions are currently completely empty, so we ignore them. Fixes: QTCREATORBUG-22691 Change-Id: I76232d160f4abed7b07574dc1b5413cead26b9f0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -130,6 +130,25 @@ void ServerCapabilities::setRenameProvider(Utils::variant<ServerCapabilities::Re
|
||||
insert(renameProviderKey, Utils::get<RenameOptions>(renameProvider));
|
||||
}
|
||||
|
||||
Utils::optional<Utils::variant<bool, JsonObject>> ServerCapabilities::colorProvider() const
|
||||
{
|
||||
using RetType = Utils::variant<bool, JsonObject>;
|
||||
const QJsonValue &localValue = value(colorProviderKey);
|
||||
if (localValue.isBool())
|
||||
return RetType(localValue.toBool());
|
||||
if (localValue.isObject())
|
||||
return RetType(JsonObject(localValue.toObject()));
|
||||
return Utils::nullopt;
|
||||
}
|
||||
|
||||
void ServerCapabilities::setColorProvider(Utils::variant<bool, JsonObject> colorProvider)
|
||||
{
|
||||
if (Utils::holds_alternative<bool>(colorProvider))
|
||||
insert(renameProviderKey, Utils::get<bool>(colorProvider));
|
||||
else if (Utils::holds_alternative<JsonObject>(colorProvider))
|
||||
insert(renameProviderKey, Utils::get<JsonObject>(colorProvider));
|
||||
}
|
||||
|
||||
bool ServerCapabilities::isValid(QStringList *error) const
|
||||
{
|
||||
return checkOptional<TextDocumentSyncOptions, int>(error, textDocumentSyncKey)
|
||||
@@ -149,7 +168,7 @@ bool ServerCapabilities::isValid(QStringList *error) const
|
||||
&& checkOptional<bool>(error, documentRangeFormattingProviderKey)
|
||||
&& checkOptional<bool, RenameOptions>(error, renameProviderKey)
|
||||
&& checkOptional<DocumentLinkOptions>(error, documentLinkProviderKey)
|
||||
&& checkOptional<TextDocumentRegistrationOptions>(error, colorProviderKey)
|
||||
&& checkOptional<bool, JsonObject>(error, colorProviderKey)
|
||||
&& checkOptional<ExecuteCommandOptions>(error, executeCommandProviderKey)
|
||||
&& checkOptional<WorkspaceServerCapabilities>(error, workspaceKey);
|
||||
}
|
||||
|
@@ -373,10 +373,8 @@ public:
|
||||
void clearDocumentLinkProvider() { remove(documentLinkProviderKey); }
|
||||
|
||||
// The server provides color provider support.
|
||||
Utils::optional<TextDocumentRegistrationOptions> colorProvider() const
|
||||
{ return optionalValue<TextDocumentRegistrationOptions>(colorProviderKey); }
|
||||
void setColorProvider(TextDocumentRegistrationOptions colorProvider)
|
||||
{ insert(colorProviderKey, colorProvider); }
|
||||
Utils::optional<Utils::variant<bool, JsonObject>> colorProvider() const;
|
||||
void setColorProvider(Utils::variant<bool, JsonObject> colorProvider);
|
||||
void clearColorProvider() { remove(colorProviderKey); }
|
||||
|
||||
// The server provides execute command support.
|
||||
|
Reference in New Issue
Block a user