diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index ada4c43f7afb793696cee62db3db26dc6f39d5e3..1e665fddda7b40a3d29eba18cf838b8fa6a91ae9 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -130,10 +130,8 @@ void QmlJSTextEditorWidget::ctor() m_updateUsesTimer = new QTimer(this); m_updateUsesTimer->setInterval(UPDATE_USES_DEFAULT_INTERVAL); m_updateUsesTimer->setSingleShot(true); - connect(m_updateUsesTimer, SIGNAL(timeout()), this, SLOT(updateUsesNow())); - - connect(this, SIGNAL(textChanged()), this, SLOT(updateUses())); - connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateUses())); + connect(m_updateUsesTimer, SIGNAL(timeout()), this, SLOT(updateUses())); + connect(this, SIGNAL(cursorPositionChanged()), m_updateUsesTimer, SLOT(start())); m_updateOutlineTimer = new QTimer(this); m_updateOutlineTimer->setInterval(UPDATE_OUTLINE_INTERVAL); @@ -424,20 +422,8 @@ void QmlJSTextEditorWidget::showTextMarker() void QmlJSTextEditorWidget::updateUses() { - if (m_semanticHighlighter->startRevision() != editorRevision()) - m_semanticHighlighter->cancel(); - m_updateUsesTimer->start(); -} - - -void QmlJSTextEditorWidget::updateUsesNow() -{ - if (m_qmlJsEditorDocument->isSemanticInfoOutdated()) { - updateUses(); + if (m_qmlJsEditorDocument->isSemanticInfoOutdated()) // will be updated when info is updated return; - } - - m_updateUsesTimer->stop(); QList<QTextEdit::ExtraSelection> selections; foreach (const AST::SourceLocation &loc, @@ -886,6 +872,8 @@ void QmlJSTextEditorWidget::semanticInfoUpdated(const SemanticInfo &semanticInfo } } + updateUses(); + // update outline m_updateOutlineTimer->start(); diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index 1bb21ad2fbb88e5a19b8a8fb7520c0ae7878bf8a..b75f7421371451dd8396fb5b818d5950a96a98d9 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -139,7 +139,6 @@ private slots: void showTextMarker(); void updateUses(); - void updateUsesNow(); void semanticInfoUpdated(const QmlJSTools::SemanticInfo &semanticInfo); void onCursorPositionChanged(); @@ -174,7 +173,7 @@ private: bool hideContextPane(); Internal::QmlJSEditorDocument *m_qmlJsEditorDocument; - QTimer *m_updateUsesTimer; + QTimer *m_updateUsesTimer; // to wait for multiple text cursor position changes QTimer *m_updateOutlineTimer; QTimer *m_updateOutlineIndexTimer; QTimer *m_cursorPositionTimer;