Commit fc7f5ba3 authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppTools: CMM::completionAssistProvider takes a mimeType

No need to pass more than needed.

Change-Id: I047cc44f17342999e0809d022df35ba9a4a8dfb8
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent cf3d47cc
......@@ -885,10 +885,13 @@ ModelManagerSupport *CppModelManager::modelManagerSupportForMimeType(const QStri
return m_idTocodeModelSupporter.value(id, m_modelManagerSupportFallback.data());
}
CppCompletionAssistProvider *CppModelManager::completionAssistProvider(Core::IEditor *editor) const
CppCompletionAssistProvider *CppModelManager::completionAssistProvider(const QString &mimeType) const
{
ModelManagerSupport *cms = modelManagerSupportForMimeType(editor->document()->mimeType());
if (mimeType.isEmpty())
return 0;
ModelManagerSupport *cms = modelManagerSupportForMimeType(mimeType);
QTC_ASSERT(cms, return 0);
return cms->completionAssistProvider();
}
......
......@@ -114,7 +114,7 @@ public:
virtual void addModelManagerSupport(ModelManagerSupport *modelManagerSupport);
virtual ModelManagerSupport *modelManagerSupportForMimeType(const QString &mimeType) const;
virtual CppCompletionAssistProvider *completionAssistProvider(Core::IEditor *editor) const;
virtual CppCompletionAssistProvider *completionAssistProvider(const QString &mimeType) const;
virtual CppHighlightingSupport *highlightingSupport(Core::IEditor *editor) const;
virtual void setIndexingSupport(CppIndexingSupport *indexingSupport);
......
......@@ -259,7 +259,7 @@ public:
virtual void addModelManagerSupport(ModelManagerSupport *modelManagerSupport) = 0;
virtual ModelManagerSupport *modelManagerSupportForMimeType(const QString &mimeType) const = 0;
virtual CppCompletionAssistProvider *completionAssistProvider(Core::IEditor *editor) const = 0;
virtual CppCompletionAssistProvider *completionAssistProvider(const QString &mimeType) const = 0;
virtual CppHighlightingSupport *highlightingSupport(Core::IEditor *editor) const = 0;
virtual void setIndexingSupport(CppTools::CppIndexingSupport *indexingSupport) = 0;
......
......@@ -122,7 +122,8 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor
, m_lastHighlightRevision(0)
, m_lastHighlightOnCompleteSemanticInfo(true)
, m_highlightingSupport(modelManager->highlightingSupport(textEditor))
, m_completionAssistProvider(m_modelManager->completionAssistProvider(textEditor))
, m_completionAssistProvider(
modelManager->completionAssistProvider(textEditor->document()->mimeType()))
{
connect(m_modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),
this, SLOT(onDocumentUpdated(CPlusPlus::Document::Ptr)));
......@@ -602,7 +603,8 @@ void CppEditorSupport::onMimeTypeChanged()
connect(this, SIGNAL(semanticInfoUpdated(CppTools::SemanticInfo)),
this, SLOT(startHighlighting()));
m_completionAssistProvider = m_modelManager->completionAssistProvider(m_textEditor);
m_completionAssistProvider
= m_modelManager->completionAssistProvider(m_textEditor->document()->mimeType());
updateDocumentNow();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment