Introduced a token cache for the C++ editor.

This should speed things up a bit, because before, the line was tokenized at
least 3 times.
This commit is contained in:
Erik Verbruggen
2010-06-04 09:36:05 +02:00
parent 414d9fe3e0
commit c2393df023
23 changed files with 244 additions and 86 deletions

View File

@@ -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; }