diff --git a/src/libs/languageserverprotocol/jsonkeys.h b/src/libs/languageserverprotocol/jsonkeys.h index 37894f166e9..a4ba26e11c8 100644 --- a/src/libs/languageserverprotocol/jsonkeys.h +++ b/src/libs/languageserverprotocol/jsonkeys.h @@ -34,6 +34,7 @@ constexpr Key codeActionKindKey{"codeActionKind"}; constexpr Key codeActionKindsKey{"codeActionKinds"}; constexpr Key codeActionLiteralSupportKey{"codeActionLiteralSupport"}; constexpr Key codeActionProviderKey{"codeActionProvider"}; +constexpr Key codeDescriptionKey{"codeDescription"}; constexpr Key codeKey{"code"}; constexpr Key codeLensKey{"codeLens"}; constexpr Key codeLensProviderKey{"codeLensProvider"}; @@ -99,6 +100,7 @@ constexpr Key greenKey{"green"}; constexpr Key hierarchicalDocumentSymbolSupportKey{"hierarchicalDocumentSymbolSupport"}; constexpr Key hoverKey{"hover"}; constexpr Key hoverProviderKey{"hoverProvider"}; +constexpr Key hrefKey{"href"}; constexpr Key idKey{"id"}; constexpr Key ignoreIfExistsKey{"ignoreIfExists"}; constexpr Key ignoreIfNotExistsKey{"ignoreIfNotExists"}; diff --git a/src/libs/languageserverprotocol/lsptypes.h b/src/libs/languageserverprotocol/lsptypes.h index 6e25fcb49d0..07e56e7c34f 100644 --- a/src/libs/languageserverprotocol/lsptypes.h +++ b/src/libs/languageserverprotocol/lsptypes.h @@ -154,6 +154,17 @@ enum class DiagnosticSeverity }; +class LANGUAGESERVERPROTOCOL_EXPORT CodeDescription : public JsonObject +{ +public: + using JsonObject::JsonObject; + + QString href() const { return typedValue(hrefKey); } + void setHref(const QString &href) { insert(hrefKey, href); } + + bool isValid() const override { return contains(hrefKey); } +}; + class LANGUAGESERVERPROTOCOL_EXPORT Diagnostic : public JsonObject { public: @@ -188,6 +199,12 @@ public: { return typedValue(messageKey); } void setMessage(const QString &message) { insert(messageKey, message); } + std::optional codeDescription() const + { return optionalValue(codeDescriptionKey); } + void setCodeDescription(const CodeDescription &codeDescription) + { insert(codeDescriptionKey, codeDescription); } + void clearCodeDescription() { remove(codeDescriptionKey); } + bool isValid() const override { return contains(rangeKey) && contains(messageKey); } };