forked from qt-creator/qt-creator
Don't waste time rehighlighting all the files opened in Creator.
This commit is contained in:
@@ -803,9 +803,6 @@ void QmlJSTextEditor::onDocumentUpdated(QmlJS::Document::Ptr doc)
|
||||
{
|
||||
if (file()->fileName() != doc->fileName()
|
||||
|| doc->editorRevision() != document()->revision()) {
|
||||
// didn't get the currently open, or an up to date document.
|
||||
// trigger a semantic rehighlight anyway, after a time
|
||||
m_semanticRehighlightTimer->start();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@ public:
|
||||
static QVector<QString> highlighterFormatCategories();
|
||||
|
||||
public slots:
|
||||
void forceSemanticRehighlight();
|
||||
void followSymbolUnderCursor();
|
||||
void findUsages();
|
||||
void showContextPane();
|
||||
@@ -187,7 +188,6 @@ private slots:
|
||||
void renameIdUnderCursor();
|
||||
|
||||
void semanticRehighlight();
|
||||
void forceSemanticRehighlight();
|
||||
void updateSemanticInfo(const QmlJSEditor::SemanticInfo &semanticInfo);
|
||||
void onCursorPositionChanged();
|
||||
void onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker);
|
||||
|
||||
@@ -241,6 +241,8 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
addAutoReleasedObject(new QuickToolBar);
|
||||
addAutoReleasedObject(new Internal::QuickToolBarSettingsPage);
|
||||
|
||||
connect(core->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -340,4 +342,14 @@ void QmlJSEditorPlugin::quickFixNow()
|
||||
}
|
||||
}
|
||||
|
||||
void QmlJSEditorPlugin::currentEditorChanged(Core::IEditor *editor)
|
||||
{
|
||||
if (! editor)
|
||||
return;
|
||||
|
||||
else if (QmlJSTextEditor *textEditor = qobject_cast<QmlJSTextEditor *>(editor->widget())) {
|
||||
textEditor->forceSemanticRehighlight();
|
||||
}
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(QmlJSEditorPlugin)
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace Core {
|
||||
class Command;
|
||||
class ActionContainer;
|
||||
class ActionManager;
|
||||
class IEditor;
|
||||
}
|
||||
|
||||
namespace TextEditor {
|
||||
@@ -95,6 +96,7 @@ public Q_SLOTS:
|
||||
private Q_SLOTS:
|
||||
void quickFix(TextEditor::ITextEditable *editable);
|
||||
void quickFixNow();
|
||||
void currentEditorChanged(Core::IEditor *editor);
|
||||
|
||||
private:
|
||||
Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Context &context, const QString &name,
|
||||
|
||||
Reference in New Issue
Block a user