forked from qt-creator/qt-creator
TextEditor: get CompletionAssistProvider from editor.
And not from the global object pool. This way, the editors that have different highlighters for various language dialects, or editors that support multiple languages in a single editor, can decide themselves on what CompletionAssistProvider to provide. Change-Id: Ieebc4a8e7b3de6470fdb8103035aa3b8b2ba6598 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "cmakeeditor.h"
|
||||
|
||||
#include "cmakefilecompletionassist.h"
|
||||
#include "cmakehighlighter.h"
|
||||
#include "cmakeeditorfactory.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
@@ -38,6 +39,7 @@
|
||||
#include <coreplugin/infobar.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <texteditor/texteditoractionhandler.h>
|
||||
@@ -77,6 +79,11 @@ Core::Id CMakeEditor::id() const
|
||||
return Core::Id(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
|
||||
}
|
||||
|
||||
TextEditor::CompletionAssistProvider *CMakeEditor::completionAssistProvider()
|
||||
{
|
||||
return ExtensionSystem::PluginManager::getObject<CMakeFileCompletionAssistProvider>();
|
||||
}
|
||||
|
||||
void CMakeEditor::markAsChanged()
|
||||
{
|
||||
if (!document()->isModified())
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <texteditor/basetextdocument.h>
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <texteditor/codeassist/completionassistprovider.h>
|
||||
#include <utils/uncommentselection.h>
|
||||
|
||||
|
||||
@@ -58,6 +59,7 @@ public:
|
||||
bool duplicateSupported() const { return true; }
|
||||
Core::IEditor *duplicate(QWidget *parent);
|
||||
Core::Id id() const;
|
||||
TextEditor::CompletionAssistProvider *completionAssistProvider();
|
||||
|
||||
private slots:
|
||||
void markAsChanged();
|
||||
|
||||
@@ -39,6 +39,8 @@ class CMakeSettingsPage;
|
||||
|
||||
class CMakeFileCompletionAssistProvider : public TextEditor::CompletionAssistProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMakeFileCompletionAssistProvider(CMakeSettingsPage *settingsPage);
|
||||
~CMakeFileCompletionAssistProvider();
|
||||
|
||||
Reference in New Issue
Block a user