aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/languageserverprotocol/languagefeatures.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/languageserverprotocol/languagefeatures.h')
-rw-r--r--src/libs/languageserverprotocol/languagefeatures.h45
1 files changed, 38 insertions, 7 deletions
diff --git a/src/libs/languageserverprotocol/languagefeatures.h b/src/libs/languageserverprotocol/languagefeatures.h
index 30f3591e64..ddd732718a 100644
--- a/src/libs/languageserverprotocol/languagefeatures.h
+++ b/src/libs/languageserverprotocol/languagefeatures.h
@@ -58,14 +58,31 @@ public:
{ return check<QString>(error, languageKey) && check<QString>(error, valueKey); }
};
-class MarkedString : public Utils::variant<MarkedLanguageString, QList<MarkedLanguageString>, MarkupContent>
+class LANGUAGESERVERPROTOCOL_EXPORT MarkedString
+ : public Utils::variant<QString, MarkedLanguageString>
{
public:
MarkedString() = default;
- explicit MarkedString(const MarkedLanguageString &other) : variant(other) {}
- explicit MarkedString(const QList<MarkedLanguageString> &other) : variant(other) {}
- explicit MarkedString(const MarkupContent &other) : variant(other) {}
+ explicit MarkedString(const MarkedLanguageString &other)
+ : variant(other)
+ {}
+ explicit MarkedString(const QString &other)
+ : variant(other)
+ {}
explicit MarkedString(const QJsonValue &value);
+
+ operator QJsonValue() const;
+};
+
+class LANGUAGESERVERPROTOCOL_EXPORT HoverContent
+ : public Utils::variant<MarkedString, QList<MarkedString>, MarkupContent>
+{
+public:
+ HoverContent() = default;
+ explicit HoverContent(const MarkedString &other) : variant(other) {}
+ explicit HoverContent(const QList<MarkedString> &other) : variant(other) {}
+ explicit HoverContent(const MarkupContent &other) : variant(other) {}
+ explicit HoverContent(const QJsonValue &value);
bool isValid(QStringList *errorHierarchy) const;
};
@@ -74,15 +91,15 @@ class LANGUAGESERVERPROTOCOL_EXPORT Hover : public JsonObject
public:
using JsonObject::JsonObject;
- MarkedString content() const;
- void setContent(const MarkedString &content);
+ HoverContent content() const;
+ void setContent(const HoverContent &content);
Utils::optional<Range> range() const { return optionalValue<Range>(rangeKey); }
void setRange(const Range &range) { insert(rangeKey, range); }
void clearRange() { remove(rangeKey); }
bool isValid(QStringList *error) const override
- { return check<MarkedString>(error, contentKey) && checkOptional<Range>(error, rangeKey); }
+ { return check<HoverContent>(error, contentsKey) && checkOptional<Range>(error, rangeKey); }
};
class LANGUAGESERVERPROTOCOL_EXPORT HoverRequest
@@ -332,9 +349,23 @@ public:
using variant::variant;
DocumentSymbolsResult() : variant(nullptr) {}
DocumentSymbolsResult(const QJsonValue &value);
+ DocumentSymbolsResult(const DocumentSymbolsResult &other) : variant(other) {}
+ DocumentSymbolsResult(DocumentSymbolsResult &&other) : variant(std::move(other)) {}
+
using variant::operator=;
+ DocumentSymbolsResult &operator =(DocumentSymbolsResult &&other)
+ {
+ variant::operator=(std::move(other));
+ return *this;
+ }
+ DocumentSymbolsResult &operator =(const DocumentSymbolsResult &other)
+ {
+ variant::operator=(other);
+ return *this;
+ }
};
+
class LANGUAGESERVERPROTOCOL_EXPORT DocumentSymbolsRequest
: public Request<DocumentSymbolsResult, std::nullptr_t, DocumentSymbolParams>
{