LanguageClient: fix semantic highlight after a server reset

Change-Id: I3a389ec82032d21e2eb932ae8d0e8d5678575427
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2022-05-20 09:57:48 +02:00
parent 8174dabe57
commit 29f8db31ff
3 changed files with 9 additions and 1 deletions

View File

@@ -280,6 +280,11 @@ void SemanticTokenSupport::setAdditionalTokenTypeStyles(
m_additionalTypeStyles = typeStyles;
}
void SemanticTokenSupport::clearTokens()
{
m_tokens.clear();
}
//void SemanticTokenSupport::setAdditionalTokenModifierStyles(
// const QHash<int, TextStyle> &modifierStyles)
//{
@@ -319,8 +324,9 @@ void SemanticTokenSupport::handleSemanticTokens(const Utils::FilePath &filePath,
int documentVersion)
{
if (auto tokens = Utils::get_if<SemanticTokens>(&result)) {
const bool force = !m_tokens.contains(filePath);
m_tokens[filePath] = {*tokens, documentVersion};
highlight(filePath);
highlight(filePath, force);
}
}