From 173fad0d3fecd01dca78ca73acf49d9f0e1ebe22 Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Tue, 6 Apr 2010 11:57:08 +0200 Subject: [PATCH] QmlJSEditor: Force a semantic rehighlight when a dependency changes. Since the revision of the current document doesn't change, we don't get rid of errors due to missing dependencies otherwise. Reviewed-by: Kai Koehne --- src/plugins/qmljseditor/qmljseditor.cpp | 7 ++++++- src/plugins/qmljseditor/qmljseditor.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index fd4a553e547..67b299755cb 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -638,7 +638,7 @@ QmlJSTextEditor::QmlJSTextEditor(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(semanticRehighlight())); + connect(m_semanticRehighlightTimer, SIGNAL(timeout()), this, SLOT(forceSemanticRehighlight())); connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument())); connect(this, SIGNAL(textChanged()), this, SLOT(updateUses())); @@ -1212,6 +1212,11 @@ QString QmlJSTextEditor::insertParagraphSeparator(const QTextCursor &) const return QLatin1String("}\n"); } +void QmlJSTextEditor::forceSemanticRehighlight() +{ + m_semanticHighlighter->rehighlight(currentSource(/* force = */ true)); +} + void QmlJSTextEditor::semanticRehighlight() { m_semanticHighlighter->rehighlight(currentSource()); diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index 5aefcab2690..6bfb3b4722c 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -233,6 +233,7 @@ private slots: void renameIdUnderCursor(); void semanticRehighlight(); + void forceSemanticRehighlight(); void updateSemanticInfo(const QmlJSEditor::Internal::SemanticInfo &semanticInfo); protected: -- GitLab