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()
|
if (file()->fileName() != doc->fileName()
|
||||||
|| doc->editorRevision() != document()->revision()) {
|
|| 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ public:
|
|||||||
static QVector<QString> highlighterFormatCategories();
|
static QVector<QString> highlighterFormatCategories();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void forceSemanticRehighlight();
|
||||||
void followSymbolUnderCursor();
|
void followSymbolUnderCursor();
|
||||||
void findUsages();
|
void findUsages();
|
||||||
void showContextPane();
|
void showContextPane();
|
||||||
@@ -187,7 +188,6 @@ private slots:
|
|||||||
void renameIdUnderCursor();
|
void renameIdUnderCursor();
|
||||||
|
|
||||||
void semanticRehighlight();
|
void semanticRehighlight();
|
||||||
void forceSemanticRehighlight();
|
|
||||||
void updateSemanticInfo(const QmlJSEditor::SemanticInfo &semanticInfo);
|
void updateSemanticInfo(const QmlJSEditor::SemanticInfo &semanticInfo);
|
||||||
void onCursorPositionChanged();
|
void onCursorPositionChanged();
|
||||||
void onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker);
|
void onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker);
|
||||||
|
|||||||
@@ -241,6 +241,8 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
|||||||
addAutoReleasedObject(new QuickToolBar);
|
addAutoReleasedObject(new QuickToolBar);
|
||||||
addAutoReleasedObject(new Internal::QuickToolBarSettingsPage);
|
addAutoReleasedObject(new Internal::QuickToolBarSettingsPage);
|
||||||
|
|
||||||
|
connect(core->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*)));
|
||||||
|
|
||||||
return true;
|
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)
|
Q_EXPORT_PLUGIN(QmlJSEditorPlugin)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ namespace Core {
|
|||||||
class Command;
|
class Command;
|
||||||
class ActionContainer;
|
class ActionContainer;
|
||||||
class ActionManager;
|
class ActionManager;
|
||||||
|
class IEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
@@ -95,6 +96,7 @@ public Q_SLOTS:
|
|||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void quickFix(TextEditor::ITextEditable *editable);
|
void quickFix(TextEditor::ITextEditable *editable);
|
||||||
void quickFixNow();
|
void quickFixNow();
|
||||||
|
void currentEditorChanged(Core::IEditor *editor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Context &context, const QString &name,
|
Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Context &context, const QString &name,
|
||||||
|
|||||||
Reference in New Issue
Block a user