diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 1212a7be59b912eac8a0143e83e0330e7256f44d..fd4a553e54756a4e904fe906b90d02809cd977d1 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -635,6 +635,11 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) : m_updateUsesTimer->setSingleShot(true); connect(m_updateUsesTimer, SIGNAL(timeout()), this, SLOT(updateUsesNow())); + m_semanticRehighlightTimer = new QTimer(this); + m_semanticRehighlightTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL); + m_semanticRehighlightTimer->setSingleShot(true); + connect(m_semanticRehighlightTimer, SIGNAL(timeout()), this, SLOT(semanticRehighlight())); + connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument())); connect(this, SIGNAL(textChanged()), this, SLOT(updateUses())); @@ -753,7 +758,7 @@ void QmlJSTextEditor::onDocumentUpdated(QmlJS::Document::Ptr doc) || doc->documentRevision() != document()->revision()) { // didn't get the currently open, or an up to date document. // trigger a semantic rehighlight anyway, after a time - updateDocument(); + m_semanticRehighlightTimer->start(); return; } diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index 179934c9b48e33acc266f92ae59ec94c38a0abca..5aefcab2690a4a368738a6d3e93fd6dc0e40a1bc 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -260,6 +260,7 @@ private: QTimer *m_updateDocumentTimer; QTimer *m_updateUsesTimer; + QTimer *m_semanticRehighlightTimer; QComboBox *m_methodCombo; ModelManagerInterface *m_modelManager; QTextCharFormat m_occurrencesFormat;