QmlJSEditor: Move reparse trigger to document

Change-Id: I65bb9002a44343bb1d13b9c5c92f5057c1d5b25e
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
Eike Ziller
2014-01-23 15:28:06 +01:00
parent 3422995521
commit 782e0d37c3
8 changed files with 105 additions and 31 deletions

View File

@@ -479,11 +479,6 @@ void QmlJSTextEditorWidget::ctor()
setAutoCompleter(new AutoCompleter);
setLanguageSettingsId(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
m_updateDocumentTimer = new QTimer(this);
m_updateDocumentTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
m_updateDocumentTimer->setSingleShot(true);
connect(m_updateDocumentTimer, SIGNAL(timeout()), this, SLOT(reparseDocumentNow()));
m_updateUsesTimer = new QTimer(this);
m_updateUsesTimer->setInterval(UPDATE_USES_DEFAULT_INTERVAL);
m_updateUsesTimer->setSingleShot(true);
@@ -494,8 +489,6 @@ void QmlJSTextEditorWidget::ctor()
m_updateSemanticInfoTimer->setSingleShot(true);
connect(m_updateSemanticInfoTimer, SIGNAL(timeout()), this, SLOT(updateSemanticInfoNow()));
connect(this, SIGNAL(textChanged()), this, SLOT(reparseDocument()));
connect(this, SIGNAL(textChanged()), this, SLOT(updateUses()));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateUses()));
@@ -610,19 +603,6 @@ bool QmlJSEditor::open(QString *errorString, const QString &fileName, const QStr
return b;
}
void QmlJSTextEditorWidget::reparseDocument()
{
m_updateDocumentTimer->start();
}
void QmlJSTextEditorWidget::reparseDocumentNow()
{
m_updateDocumentTimer->stop();
const QString fileName = baseTextDocument()->filePath();
m_modelManager->updateSourceFiles(QStringList() << fileName, false);
}
static void appendExtraSelectionsForMessages(
QList<QTextEdit::ExtraSelection> *selections,
const QList<DiagnosticMessage> &messages,