forked from qt-creator/qt-creator
LanguageClient: update semantic highlighting only if server supports it
Task-number: QTCREATORBUG-23599 Change-Id: I76c804b51362ad6ab2aecf0631a16289a33e4810 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -392,8 +392,10 @@ void Client::deactivateDocument(TextEditor::TextDocument *document)
|
||||
hideDiagnostics(document);
|
||||
resetAssistProviders(document);
|
||||
document->setFormatter(nullptr);
|
||||
if (m_serverCapabilities.semanticHighlighting().has_value()) {
|
||||
if (TextEditor::SyntaxHighlighter *highlighter = document->syntaxHighlighter())
|
||||
highlighter->clearAllExtraFormats();
|
||||
}
|
||||
for (Core::IEditor *editor : Core::DocumentModel::editorsForDocument(document)) {
|
||||
if (auto textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor))
|
||||
textEditor->editorWidget()->removeHoverHandler(&m_hoverHandler);
|
||||
|
@@ -151,11 +151,13 @@ void applyHighlight(TextEditor::TextDocument *doc,
|
||||
}
|
||||
}
|
||||
|
||||
if (capabilities.semanticHighlighting().has_value()) {
|
||||
TextEditor::SemanticHighlighter::setExtraAdditionalFormats(
|
||||
doc->syntaxHighlighter(),
|
||||
results,
|
||||
scopesToFormatHash(highlightScopes(capabilities), doc->fontSettings()));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace SemanticHighligtingSupport
|
||||
} // namespace LanguageClient
|
||||
|
Reference in New Issue
Block a user