forked from qt-creator/qt-creator
LSP: Add Diagnostic.CodeDescription to the protocol implementation
see https://microsoft.github.io/language-server-protocol/specifications/ lsp/3.17/specification/#codeDescription Change-Id: Id2f92f1aea73928306be413afda636dcec978cf7 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -34,6 +34,7 @@ constexpr Key codeActionKindKey{"codeActionKind"};
|
|||||||
constexpr Key codeActionKindsKey{"codeActionKinds"};
|
constexpr Key codeActionKindsKey{"codeActionKinds"};
|
||||||
constexpr Key codeActionLiteralSupportKey{"codeActionLiteralSupport"};
|
constexpr Key codeActionLiteralSupportKey{"codeActionLiteralSupport"};
|
||||||
constexpr Key codeActionProviderKey{"codeActionProvider"};
|
constexpr Key codeActionProviderKey{"codeActionProvider"};
|
||||||
|
constexpr Key codeDescriptionKey{"codeDescription"};
|
||||||
constexpr Key codeKey{"code"};
|
constexpr Key codeKey{"code"};
|
||||||
constexpr Key codeLensKey{"codeLens"};
|
constexpr Key codeLensKey{"codeLens"};
|
||||||
constexpr Key codeLensProviderKey{"codeLensProvider"};
|
constexpr Key codeLensProviderKey{"codeLensProvider"};
|
||||||
@@ -99,6 +100,7 @@ constexpr Key greenKey{"green"};
|
|||||||
constexpr Key hierarchicalDocumentSymbolSupportKey{"hierarchicalDocumentSymbolSupport"};
|
constexpr Key hierarchicalDocumentSymbolSupportKey{"hierarchicalDocumentSymbolSupport"};
|
||||||
constexpr Key hoverKey{"hover"};
|
constexpr Key hoverKey{"hover"};
|
||||||
constexpr Key hoverProviderKey{"hoverProvider"};
|
constexpr Key hoverProviderKey{"hoverProvider"};
|
||||||
|
constexpr Key hrefKey{"href"};
|
||||||
constexpr Key idKey{"id"};
|
constexpr Key idKey{"id"};
|
||||||
constexpr Key ignoreIfExistsKey{"ignoreIfExists"};
|
constexpr Key ignoreIfExistsKey{"ignoreIfExists"};
|
||||||
constexpr Key ignoreIfNotExistsKey{"ignoreIfNotExists"};
|
constexpr Key ignoreIfNotExistsKey{"ignoreIfNotExists"};
|
||||||
|
@@ -154,6 +154,17 @@ enum class DiagnosticSeverity
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LANGUAGESERVERPROTOCOL_EXPORT CodeDescription : public JsonObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using JsonObject::JsonObject;
|
||||||
|
|
||||||
|
QString href() const { return typedValue<QString>(hrefKey); }
|
||||||
|
void setHref(const QString &href) { insert(hrefKey, href); }
|
||||||
|
|
||||||
|
bool isValid() const override { return contains(hrefKey); }
|
||||||
|
};
|
||||||
|
|
||||||
class LANGUAGESERVERPROTOCOL_EXPORT Diagnostic : public JsonObject
|
class LANGUAGESERVERPROTOCOL_EXPORT Diagnostic : public JsonObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -188,6 +199,12 @@ public:
|
|||||||
{ return typedValue<QString>(messageKey); }
|
{ return typedValue<QString>(messageKey); }
|
||||||
void setMessage(const QString &message) { insert(messageKey, message); }
|
void setMessage(const QString &message) { insert(messageKey, message); }
|
||||||
|
|
||||||
|
std::optional<CodeDescription> codeDescription() const
|
||||||
|
{ return optionalValue<CodeDescription>(codeDescriptionKey); }
|
||||||
|
void setCodeDescription(const CodeDescription &codeDescription)
|
||||||
|
{ insert(codeDescriptionKey, codeDescription); }
|
||||||
|
void clearCodeDescription() { remove(codeDescriptionKey); }
|
||||||
|
|
||||||
bool isValid() const override { return contains(rangeKey) && contains(messageKey); }
|
bool isValid() const override { return contains(rangeKey) && contains(messageKey); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user