From bbb06a72ec7fe7b91d10f9ead4e635f630253020 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 9 Aug 2021 14:44:34 +0200 Subject: [PATCH] LanguageClient: reapply semantic highlight after font changed Change-Id: I609e26b7f85744fdffb8399e0d651691b7c39900 Reviewed-by: Christian Kandeler --- src/plugins/languageclient/client.cpp | 1 + src/plugins/languageclient/semantichighlightsupport.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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(