forked from qt-creator/qt-creator
LSP: allow non versioned text document in SemanticHighlightingParams
The proposal of SemanticHighlighting uses a versioned text document identifier, but there is a suggestion to be more coherent with other existing requests and use text document identifier instead (non versionned). See here: https://github.com/microsoft/vscode-languageserver-node/pull/367/files#r225879268 The clangd language server implements the non versioned version. Existing code was returning errors with clangd because SemanticHighlightingParams::isValid would return false because of the missing version field. Change-Id: I1c36151342437adad2405118ca6b303db0936e41 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1215,9 +1215,18 @@ void Client::handleDiagnostics(const PublishDiagnosticsParams ¶ms)
|
||||
|
||||
void Client::handleSemanticHighlight(const SemanticHighlightingParams ¶ms)
|
||||
{
|
||||
const DocumentUri &uri = params.textDocument().uri();
|
||||
DocumentUri uri;
|
||||
LanguageClientValue<int> version;
|
||||
auto textDocument = params.textDocument();
|
||||
|
||||
if (Utils::holds_alternative<VersionedTextDocumentIdentifier>(textDocument)) {
|
||||
uri = Utils::get<VersionedTextDocumentIdentifier>(textDocument).uri();
|
||||
version = Utils::get<VersionedTextDocumentIdentifier>(textDocument).version();
|
||||
} else {
|
||||
uri = Utils::get<TextDocumentIdentifier>(textDocument).uri();
|
||||
}
|
||||
|
||||
m_highlights[uri].clear();
|
||||
const LanguageClientValue<int> &version = params.textDocument().version();
|
||||
TextEditor::TextDocument *doc = TextEditor::TextDocument::textDocumentForFilePath(
|
||||
uri.toFilePath());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user