LanguageClient: Fix document version update

... for empty semantic tokens delta.
Amends 86061fb44a.

Change-Id: Id6d6cdc1904ea5353d18cea57b55ed3fa16727de
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-10-22 15:48:59 +02:00
parent d84de31384
commit 2eb50afd9c

View File

@@ -392,6 +392,7 @@ void SemanticTokenSupport::handleSemanticTokensDelta(
if (auto tokens = Utils::get_if<SemanticTokens>(&result)) { if (auto tokens = Utils::get_if<SemanticTokens>(&result)) {
m_tokens[filePath] = {*tokens, documentVersion}; m_tokens[filePath] = {*tokens, documentVersion};
} else if (auto tokensDelta = Utils::get_if<SemanticTokensDelta>(&result)) { } else if (auto tokensDelta = Utils::get_if<SemanticTokensDelta>(&result)) {
m_tokens[filePath].version = documentVersion;
QList<SemanticTokensEdit> edits = tokensDelta->edits(); QList<SemanticTokensEdit> edits = tokensDelta->edits();
if (edits.isEmpty()) { if (edits.isEmpty()) {
highlight(filePath); highlight(filePath);
@@ -400,7 +401,6 @@ void SemanticTokenSupport::handleSemanticTokensDelta(
Utils::sort(edits, &SemanticTokensEdit::start); Utils::sort(edits, &SemanticTokensEdit::start);
m_tokens[filePath].version = documentVersion;
SemanticTokens &tokens = m_tokens[filePath].tokens; SemanticTokens &tokens = m_tokens[filePath].tokens;
const QList<int> &data = tokens.data(); const QList<int> &data = tokens.data();