ClangCodeModel: Force clangd re-highlighting on font settings change

Change-Id: Ie449a5329bd49eac116751e66a07602f316e147d
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-11-15 14:58:40 +01:00
parent b41280b942
commit 5769dbe0aa
3 changed files with 10 additions and 10 deletions

View File

@@ -1072,7 +1072,7 @@ public:
const QString &type = {});
void handleSemanticTokens(TextDocument *doc, const QList<ExpandedSemanticToken> &tokens,
int version);
int version, bool force);
enum class AstCallbackMode { SyncIfPossible, AlwaysAsync };
using TextDocOrFile = const Utils::variant<const TextDocument *, Utils::FilePath>;
@@ -1270,8 +1270,8 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir)
setDiagnosticsHandlers(textMarkCreator, hideDiagsHandler);
setSymbolStringifier(displayNameFromDocumentSymbol);
setSemanticTokensHandler([this](TextDocument *doc, const QList<ExpandedSemanticToken> &tokens,
int version) {
d->handleSemanticTokens(doc, tokens, version);
int version, bool force) {
d->handleSemanticTokens(doc, tokens, version, force);
});
hoverHandler()->setHelpItemProvider([this](const HoverRequest::Response &response,
const DocumentUri &uri) {
@@ -2630,7 +2630,7 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
// in the semantic tokens nor in the AST.
void ClangdClient::Private::handleSemanticTokens(TextDocument *doc,
const QList<ExpandedSemanticToken> &tokens,
int version)
int version, bool force)
{
SubtaskTimer t(highlightingTimer);
qCDebug(clangdLog) << "handling LSP tokens" << doc->filePath() << tokens.size();
@@ -2641,7 +2641,7 @@ void ClangdClient::Private::handleSemanticTokens(TextDocument *doc,
}
const auto previous = previousTokens.find(doc);
if (previous != previousTokens.end()) {
if (previous->first == tokens && previous->second == version) {
if (!force && previous->first == tokens && previous->second == version) {
qCDebug(clangdLogHighlight) << "tokens and version same as last time; nothing to do";
return;
}