From aee9a55a819971bc9bcddedf8b2c3b489ed9e61d Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Wed, 8 Jun 2011 12:58:46 +0200 Subject: QmlJS: Fix missing rehighlight if other file changes. When QML modules with many source files were loaded, the rehighlight from the found library was done before the files contained in the library were done parsing. This way any updated document will eventually lead to the current editor rehighlighting. Reviewed-by: Erik Verbruggen Change-Id: I0f4d18390d3e0ee17cd255c68496f61479f82f05x Reviewed-on: http://codereview.qt.nokia.com/382 Reviewed-by: Qt Sanity Bot Reviewed-by: hjk --- src/plugins/qmljseditor/qmljseditor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 4261431953..f2eba64f42 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -635,7 +635,7 @@ QmlJSTextEditorWidget::QmlJSTextEditorWidget(QWidget *parent) : m_semanticRehighlightTimer = new QTimer(this); m_semanticRehighlightTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL); m_semanticRehighlightTimer->setSingleShot(true); - connect(m_semanticRehighlightTimer, SIGNAL(timeout()), this, SLOT(forceSemanticRehighlight())); + connect(m_semanticRehighlightTimer, SIGNAL(timeout()), this, SLOT(forceSemanticRehighlightIfCurrentEditor())); connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument())); @@ -808,6 +808,9 @@ void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc) { if (file()->fileName() != doc->fileName() || doc->editorRevision() != document()->revision()) { + // maybe a dependency changed: schedule a potential rehighlight + // will not rehighlight if the current editor changes away from this file + m_semanticRehighlightTimer->start(); return; } -- cgit v1.2.3