forked from qt-creator/qt-creator
QmlJS: Avoid frequent libraryInfoUpdated emissions.
Also don't require a rehighlight of every open document when the signal is emitted. Reviewed-by: Roberto Raggi
This commit is contained in:
@@ -676,7 +676,7 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
|
||||
connect(m_modelManager, SIGNAL(documentUpdated(QmlJS::Document::Ptr)),
|
||||
this, SLOT(onDocumentUpdated(QmlJS::Document::Ptr)));
|
||||
connect(m_modelManager, SIGNAL(libraryInfoUpdated(QString,QmlJS::LibraryInfo)),
|
||||
this, SLOT(forceSemanticRehighlight()));
|
||||
this, SLOT(forceSemanticRehighlightIfCurrentEditor()));
|
||||
connect(this->document(), SIGNAL(modificationChanged(bool)), this, SLOT(modificationChanged(bool)));
|
||||
}
|
||||
|
||||
@@ -1465,6 +1465,13 @@ void QmlJSTextEditor::forceSemanticRehighlight()
|
||||
m_semanticHighlighter->rehighlight(currentSource(/* force = */ true));
|
||||
}
|
||||
|
||||
void QmlJSEditor::QmlJSTextEditor::forceSemanticRehighlightIfCurrentEditor()
|
||||
{
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
if (editorManager->currentEditor() == editableInterface())
|
||||
forceSemanticRehighlight();
|
||||
}
|
||||
|
||||
void QmlJSTextEditor::semanticRehighlight()
|
||||
{
|
||||
m_semanticHighlighter->rehighlight(currentSource());
|
||||
|
Reference in New Issue
Block a user