diff options
Diffstat (limited to 'src/libs/languageserverprotocol/languagefeatures.h')
-rw-r--r-- | src/libs/languageserverprotocol/languagefeatures.h | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/src/libs/languageserverprotocol/languagefeatures.h b/src/libs/languageserverprotocol/languagefeatures.h index bee7cbd04f..074f6440af 100644 --- a/src/libs/languageserverprotocol/languagefeatures.h +++ b/src/libs/languageserverprotocol/languagefeatures.h @@ -778,6 +778,45 @@ public: constexpr static const char methodName[] = "textDocument/onTypeFormatting"; }; +class PlaceHolderResult : public JsonObject +{ +public: + using JsonObject::JsonObject; + + Range range() const { return typedValue<Range>(rangeKey); } + void setRange(const Range &range) { insert(rangeKey, range); } + + QString placeHolder() const { return typedValue<QString>(placeHolderKey); } + void setPlaceHolder(const QString &placeHolder) { insert(placeHolderKey, placeHolder); } + + bool isValid(ErrorHierarchy *error) const override + { + return check<Range>(error, rangeKey) && checkOptional<QString>(error, placeHolderKey); + } +}; + +class LANGUAGESERVERPROTOCOL_EXPORT PrepareRenameResult + : public Utils::variant<PlaceHolderResult, Range, std::nullptr_t> +{ +public: + PrepareRenameResult(); + PrepareRenameResult(const Utils::variant<PlaceHolderResult, Range, std::nullptr_t> &val); + explicit PrepareRenameResult(const PlaceHolderResult &val); + explicit PrepareRenameResult(const Range &val); + PrepareRenameResult(const QJsonValue &val); + + bool isValid(ErrorHierarchy *error) const; +}; + +class LANGUAGESERVERPROTOCOL_EXPORT PrepareRenameRequest + : public Request<PrepareRenameResult, std::nullptr_t, TextDocumentPositionParams> +{ +public: + PrepareRenameRequest(const TextDocumentPositionParams ¶ms = TextDocumentPositionParams()); + using Request::Request; + constexpr static const char methodName[] = "textDocument/prepareRename"; +}; + class LANGUAGESERVERPROTOCOL_EXPORT RenameParams : public JsonObject { public: @@ -841,8 +880,9 @@ class LANGUAGESERVERPROTOCOL_EXPORT SemanticHighlightingParams : public JsonObje public: using JsonObject::JsonObject; - VersionedTextDocumentIdentifier textDocument() const - { return typedValue<VersionedTextDocumentIdentifier>(textDocumentKey); } + Utils::variant<VersionedTextDocumentIdentifier, TextDocumentIdentifier> textDocument() const; + void setTextDocument(const TextDocumentIdentifier &textDocument) + { insert(textDocumentKey, textDocument); } void setTextDocument(const VersionedTextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } |