diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index 9a42f38ef9e..e2291f6d021 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -1354,6 +1354,7 @@ void Client::handleSemanticHighlight(const SemanticHighlightingParams ¶ms) void Client::rehighlight() { using namespace TextEditor; + m_tokentSupport.rehighlight(); for (auto it = m_highlights.begin(), end = m_highlights.end(); it != end; ++it) { if (TextDocument *doc = TextDocument::textDocumentForFilePath(it.key().toFilePath())) { if (LanguageClientManager::clientForDocument(doc) == this) diff --git a/src/plugins/languageclient/semantichighlightsupport.cpp b/src/plugins/languageclient/semantichighlightsupport.cpp index ea5adceccd1..e27c3fbbd55 100644 --- a/src/plugins/languageclient/semantichighlightsupport.cpp +++ b/src/plugins/languageclient/semantichighlightsupport.cpp @@ -374,8 +374,9 @@ void SemanticTokenSupport::handleSemanticTokens(const Utils::FilePath &filePath, if (auto tokens = Utils::get_if(&result)) { m_tokens[filePath] = *tokens; highlight(filePath); + } else { + m_tokens.remove(filePath); } - m_tokens.remove(filePath); } void SemanticTokenSupport::handleSemanticTokensDelta(