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);
|
hideDiagnostics(document);
|
||||||
resetAssistProviders(document);
|
resetAssistProviders(document);
|
||||||
document->setFormatter(nullptr);
|
document->setFormatter(nullptr);
|
||||||
|
if (m_serverCapabilities.semanticHighlighting().has_value()) {
|
||||||
if (TextEditor::SyntaxHighlighter *highlighter = document->syntaxHighlighter())
|
if (TextEditor::SyntaxHighlighter *highlighter = document->syntaxHighlighter())
|
||||||
highlighter->clearAllExtraFormats();
|
highlighter->clearAllExtraFormats();
|
||||||
|
}
|
||||||
for (Core::IEditor *editor : Core::DocumentModel::editorsForDocument(document)) {
|
for (Core::IEditor *editor : Core::DocumentModel::editorsForDocument(document)) {
|
||||||
if (auto textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor))
|
if (auto textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor))
|
||||||
textEditor->editorWidget()->removeHoverHandler(&m_hoverHandler);
|
textEditor->editorWidget()->removeHoverHandler(&m_hoverHandler);
|
||||||
|
@@ -151,11 +151,13 @@ void applyHighlight(TextEditor::TextDocument *doc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (capabilities.semanticHighlighting().has_value()) {
|
||||||
TextEditor::SemanticHighlighter::setExtraAdditionalFormats(
|
TextEditor::SemanticHighlighter::setExtraAdditionalFormats(
|
||||||
doc->syntaxHighlighter(),
|
doc->syntaxHighlighter(),
|
||||||
results,
|
results,
|
||||||
scopesToFormatHash(highlightScopes(capabilities), doc->fontSettings()));
|
scopesToFormatHash(highlightScopes(capabilities), doc->fontSettings()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace SemanticHighligtingSupport
|
} // namespace SemanticHighligtingSupport
|
||||||
} // namespace LanguageClient
|
} // namespace LanguageClient
|
||||||
|
Reference in New Issue
Block a user