forked from qt-creator/qt-creator
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 <qt_sanity_bot@ovi.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user