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 <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2022-04-22 10:52:31 +02:00
parent fabbf88db5
commit 26df1852d0

View File

@@ -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);