From f55d5d8ec1d81a6cbcfb224d06312270787a22cd Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 8 Jul 2021 12:00:13 +0200 Subject: [PATCH] LanguageClient: Do not re-highlight when receiving the error variant ... of a SemanticTokens message. Change-Id: I0f6e55d6656c11e7925e3bc4400ea2e575b9f138 Reviewed-by: David Schulz --- src/plugins/languageclient/semantichighlightsupport.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/languageclient/semantichighlightsupport.cpp b/src/plugins/languageclient/semantichighlightsupport.cpp index 3aafaf5b42f..ea5adceccd1 100644 --- a/src/plugins/languageclient/semantichighlightsupport.cpp +++ b/src/plugins/languageclient/semantichighlightsupport.cpp @@ -371,11 +371,11 @@ SemanticRequestTypes SemanticTokenSupport::supportedSemanticRequests(TextDocumen void SemanticTokenSupport::handleSemanticTokens(const Utils::FilePath &filePath, const SemanticTokensResult &result) { - if (auto tokens = Utils::get_if(&result)) + if (auto tokens = Utils::get_if(&result)) { m_tokens[filePath] = *tokens; - else - m_tokens.remove(filePath); - highlight(filePath); + highlight(filePath); + } + m_tokens.remove(filePath); } void SemanticTokenSupport::handleSemanticTokensDelta( @@ -427,6 +427,7 @@ void SemanticTokenSupport::handleSemanticTokensDelta( tokens.setResultId(tokensDelta->resultId()); } else { m_tokens.remove(filePath); + return; } highlight(filePath); }