LanguageClient: Do not re-highlight when receiving the error variant

... of a SemanticTokens message.

Change-Id: I0f6e55d6656c11e7925e3bc4400ea2e575b9f138
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-07-08 12:00:13 +02:00
parent 1f4826a0c4
commit f55d5d8ec1

View File

@@ -371,11 +371,11 @@ SemanticRequestTypes SemanticTokenSupport::supportedSemanticRequests(TextDocumen
void SemanticTokenSupport::handleSemanticTokens(const Utils::FilePath &filePath, void SemanticTokenSupport::handleSemanticTokens(const Utils::FilePath &filePath,
const SemanticTokensResult &result) const SemanticTokensResult &result)
{ {
if (auto tokens = Utils::get_if<SemanticTokens>(&result)) if (auto tokens = Utils::get_if<SemanticTokens>(&result)) {
m_tokens[filePath] = *tokens; m_tokens[filePath] = *tokens;
else highlight(filePath);
m_tokens.remove(filePath); }
highlight(filePath); m_tokens.remove(filePath);
} }
void SemanticTokenSupport::handleSemanticTokensDelta( void SemanticTokenSupport::handleSemanticTokensDelta(
@@ -427,6 +427,7 @@ void SemanticTokenSupport::handleSemanticTokensDelta(
tokens.setResultId(tokensDelta->resultId()); tokens.setResultId(tokensDelta->resultId());
} else { } else {
m_tokens.remove(filePath); m_tokens.remove(filePath);
return;
} }
highlight(filePath); highlight(filePath);
} }