C++: unify highlighting/code-completion support "factories".

Both semantic highlighting and code-completion go hand-in-hand, so now
the ModelManagerSupport class acts as a "factory" for the model manager.
Depending on the mime-type of the document in the editor, the model
manager will return the appropriate highlighter or code-completion
engine. If none is registered, the built-in fall-back is used.

Change-Id: I3e5dbb0e3b58e077dd5eda9aecb2ce5d448ac0b8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2013-09-04 18:15:08 +02:00
parent 0c6b64484c
commit 3a5d3a2fe9
13 changed files with 264 additions and 74 deletions

View File

@@ -105,11 +105,10 @@ public:
void finishedRefreshingSourceFiles(const QStringList &files);
virtual void addModelManagerSupport(ModelManagerSupport *codeModelSupport);
virtual ModelManagerSupport *modelManagerSupportForMimeType(const QString &mimeType) const;
virtual CppCompletionAssistProvider *completionAssistProvider(Core::IEditor *editor) const;
virtual void setCppCompletionAssistProvider(CppCompletionAssistProvider *completionAssistProvider);
virtual CppHighlightingSupport *highlightingSupport(Core::IEditor *editor) const;
virtual void setHighlightingSupportFactory(CppHighlightingSupportFactory *highlightingFactory);
virtual void setIndexingSupport(CppIndexingSupport *indexingSupport);
virtual CppIndexingSupport *indexingSupport();
@@ -202,13 +201,10 @@ private:
QMap<TextEditor::BaseTextEditor *, CppEditorSupport *> m_cppEditorSupports;
QSet<AbstractEditorSupport *> m_extraEditorSupports;
// Completion
CppCompletionAssistProvider *m_completionAssistProvider;
QScopedPointer<CppCompletionAssistProvider> m_completionFallback;
// Highlighting
CppHighlightingSupportFactory *m_highlightingFactory;
CppHighlightingSupportFactory *m_highlightingFallback;
// Completion & highlighting
QList<ModelManagerSupport *> m_codeModelSupporters;
QScopedPointer<ModelManagerSupport> m_modelManagerSupportFallback;
QHash<QString, ModelManagerSupport *> m_mimeTypeToCodeModelSupport;
// Indexing
CppIndexingSupport *m_indexingSupporter;