QmlJS editor: Simplify document/semInfo updating significantly.

* Instead of having SemanticInfoUpdater reparse documents itself, it now
  relies on the ModelManager doing that.
* SemanticInfoUpdater now takes a doc and snapshot to generate the
  convenience Context / ScopeChain. Could be converted into a future
  to avoid having a (99% idle) thread per editor.
* Renamed several functions in QmlJSTextEditorWidget to better indicate
  their behavior.

Change-Id: I8af6ccab099130fa7fa227e44864561ca2c3f9e0
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-11-18 13:25:09 +01:00
committed by Leandro Melo
parent fa6c3cc1ec
commit 56bf0e3023
7 changed files with 95 additions and 158 deletions

View File

@@ -156,8 +156,8 @@ public:
virtual void unCommentSelection();
SemanticInfo semanticInfo() const;
bool isSemanticInfoOutdated() const;
int editorRevision() const;
bool isOutdated() const;
Internal::QmlOutlineModel *outlineModel() const;
QModelIndex outlineModelIndex();
@@ -172,7 +172,10 @@ public:
public slots:
virtual void setTabSettings(const TextEditor::TabSettings &ts);
void forceReparse();
void reparseDocument();
void reparseDocumentNow();
void updateSemanticInfo();
void updateSemanticInfoNow();
void followSymbolUnderCursor();
void findUsages();
void renameUsages();
@@ -188,8 +191,6 @@ private slots:
void onDocumentUpdated(QmlJS::Document::Ptr doc);
void modificationChanged(bool);
void updateDocument();
void updateDocumentNow();
void jumpToOutlineElement(int index);
void updateOutlineNow();
void updateOutlineIndexNow();
@@ -200,9 +201,7 @@ private slots:
void updateUses();
void updateUsesNow();
void reparse();
void forceReparseIfCurrentEditor();
void updateSemanticInfo(const QmlJSEditor::SemanticInfo &semanticInfo);
void acceptNewSemanticInfo(const QmlJSEditor::SemanticInfo &semanticInfo);
void onCursorPositionChanged();
void onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker);
@@ -225,7 +224,6 @@ private:
void setSelectedElements();
QString wordUnderCursor() const;
Internal::SemanticInfoUpdaterSource currentSource(bool force = false);
QModelIndex indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex = QModelIndex()) const;
bool hideContextPane();
@@ -233,7 +231,7 @@ private:
QTimer *m_updateDocumentTimer;
QTimer *m_updateUsesTimer;
QTimer *m_localReparseTimer;
QTimer *m_updateSemanticInfoTimer;
QTimer *m_updateOutlineTimer;
QTimer *m_updateOutlineIndexTimer;
QTimer *m_cursorPositionTimer;