forked from qt-creator/qt-creator
LSP: add PrepareRename request to the protocol implementation
Task-number: QTCREATORBUG-21578 Change-Id: I5bd87610d7c49f1e4a09ee1bd2221e4786a1856b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -245,6 +245,10 @@ DocumentOnTypeFormattingRequest::DocumentOnTypeFormattingRequest(
|
||||
: Request(methodName, params)
|
||||
{ }
|
||||
|
||||
PrepareRenameRequest::PrepareRenameRequest(const TextDocumentPositionParams ¶ms)
|
||||
: Request(methodName, params)
|
||||
{ }
|
||||
|
||||
bool RenameParams::isValid(ErrorHierarchy *error) const
|
||||
{
|
||||
return check<TextDocumentIdentifier>(error, textDocumentKey)
|
||||
@@ -511,4 +515,35 @@ bool SemanticHighlightingParams::isValid(ErrorHierarchy *error) const
|
||||
&& checkArray<SemanticHighlightingInformation>(error, linesKey);
|
||||
}
|
||||
|
||||
PrepareRenameResult::PrepareRenameResult()
|
||||
: Utils::variant<PlaceHolderResult, Range, nullptr_t>(nullptr)
|
||||
{}
|
||||
|
||||
PrepareRenameResult::PrepareRenameResult(
|
||||
const Utils::variant<PlaceHolderResult, Range, std::nullptr_t> &val)
|
||||
: Utils::variant<PlaceHolderResult, Range, nullptr_t>(val)
|
||||
{}
|
||||
|
||||
PrepareRenameResult::PrepareRenameResult(const PlaceHolderResult &val)
|
||||
: Utils::variant<PlaceHolderResult, Range, nullptr_t>(val)
|
||||
|
||||
{}
|
||||
|
||||
PrepareRenameResult::PrepareRenameResult(const Range &val)
|
||||
: Utils::variant<PlaceHolderResult, Range, nullptr_t>(val)
|
||||
{}
|
||||
|
||||
PrepareRenameResult::PrepareRenameResult(const QJsonValue &val)
|
||||
{
|
||||
if (val.isNull()) {
|
||||
emplace<std::nullptr_t>(nullptr);
|
||||
} else if (val.isObject()) {
|
||||
const QJsonObject object = val.toObject();
|
||||
if (object.keys().contains(rangeKey))
|
||||
emplace<PlaceHolderResult>(PlaceHolderResult(object));
|
||||
else
|
||||
emplace<Range>(Range(object));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LanguageServerProtocol
|
||||
|
||||
Reference in New Issue
Block a user