forked from qt-creator/qt-creator
Introduced token caching to prevent repetetive tokenizing.
Also removed TokenUnderCursor as it's functionality is in the token cache. Reviewed-by: ckamm
This commit is contained in:
@@ -67,8 +67,12 @@ void CppEditorSupport::setTextEditor(TextEditor::ITextEditor *textEditor)
|
||||
{
|
||||
_textEditor = textEditor;
|
||||
|
||||
if (! _textEditor)
|
||||
if (_textEditor) {
|
||||
if (TextEditor::BaseTextEditor *ed = qobject_cast<TextEditor::BaseTextEditor *>(_textEditor->widget()))
|
||||
_tokenCache.setDocument(ed->document());
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
connect(_textEditor, SIGNAL(contentsChanged()), this, SIGNAL(contentsChanged()));
|
||||
connect(this, SIGNAL(contentsChanged()), this, SLOT(updateDocument()));
|
||||
@@ -96,6 +100,11 @@ unsigned CppEditorSupport::editorRevision() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
TokenCache *CppEditorSupport::tokenCache()
|
||||
{
|
||||
return &_tokenCache;
|
||||
}
|
||||
|
||||
int CppEditorSupport::updateDocumentInterval() const
|
||||
{ return _updateDocumentInterval; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user