From 26df1852d0ca239858774ed5951b79626abf7cae Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 22 Apr 2022 10:52:31 +0200 Subject: [PATCH] LanguageClient: do not highlight unknown tokens If the language server registers token types for unsupported tokens do not use the default text style for those tokens since it might overwrite correct syntax highlighting. Thanks to Alex Drozdov for providing a patch Fixes: QTCREATORBUG-26193 Change-Id: I5d70763bc1e9434ffc6241d94f50f3bb3852e62c Reviewed-by: Christian Stenger --- src/plugins/languageclient/semantichighlightsupport.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/languageclient/semantichighlightsupport.cpp b/src/plugins/languageclient/semantichighlightsupport.cpp index 3e3279a653a..883b604885d 100644 --- a/src/plugins/languageclient/semantichighlightsupport.cpp +++ b/src/plugins/languageclient/semantichighlightsupport.cpp @@ -246,8 +246,7 @@ void SemanticTokenSupport::updateFormatHash() case numberToken: style = C_NUMBER; break; case operatorToken: style = C_OPERATOR; break; default: - style = m_additionalTypeStyles.value(tokenType, C_TEXT); - break; + continue; } int mainHashPart = tokenType << tokenTypeBitOffset; m_formatHash[mainHashPart] = fontSettings.toTextCharFormat(style);