Commit e53b5bc9 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Fixed completion settings to also apply to the QML code completion



By moving the completion settings into the TextEditor plugin, so that
both the CppTools and the QmlJSEditor plugins can access the settings.

The user-interface to edit the settings is still in the CppTools plugin,
since we're in string freeze at the moment. It should be moved to the
TextEditor plugin later.

For now the QML completion only supports the case-sensitivity and
partial completion options, since there is no automatic insertion of
brackets.

Task-number: QTCREATORBUG-1327
Reviewed-by: default avatarDaniel Molkentin <daniel.molkentin@nokia.com>
parent b8f7d447
...@@ -32,15 +32,15 @@ ...@@ -32,15 +32,15 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <texteditor/texteditorsettings.h>
#include <QtCore/QTextStream> #include <QtCore/QTextStream>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
using namespace CppTools::Internal; using namespace CppTools::Internal;
CompletionSettingsPage::CompletionSettingsPage(CppCodeCompletion *completion) CompletionSettingsPage::CompletionSettingsPage()
: m_completion(completion) : m_page(new Ui_CompletionSettingsPage)
, m_page(new Ui_CompletionSettingsPage)
{ {
} }
...@@ -64,23 +64,27 @@ QWidget *CompletionSettingsPage::createPage(QWidget *parent) ...@@ -64,23 +64,27 @@ QWidget *CompletionSettingsPage::createPage(QWidget *parent)
QWidget *w = new QWidget(parent); QWidget *w = new QWidget(parent);
m_page->setupUi(w); m_page->setupUi(w);
const TextEditor::CompletionSettings &settings =
TextEditor::TextEditorSettings::instance()->completionSettings();
int caseSensitivityIndex = 0; int caseSensitivityIndex = 0;
switch (m_completion->caseSensitivity()) { switch (settings.m_caseSensitivity) {
case CppCodeCompletion::CaseSensitive: case TextEditor::CaseSensitive:
caseSensitivityIndex = 0; caseSensitivityIndex = 0;
break; break;
case CppCodeCompletion::CaseInsensitive: case TextEditor::CaseInsensitive:
caseSensitivityIndex = 1; caseSensitivityIndex = 1;
break; break;
case CppCodeCompletion::FirstLetterCaseSensitive: case TextEditor::FirstLetterCaseSensitive:
caseSensitivityIndex = 2; caseSensitivityIndex = 2;
break; break;
} }
m_page->caseSensitivity->setCurrentIndex(caseSensitivityIndex); m_page->caseSensitivity->setCurrentIndex(caseSensitivityIndex);
m_page->autoInsertBrackets->setChecked(m_completion->autoInsertBrackets()); m_page->autoInsertBrackets->setChecked(settings.m_autoInsertBrackets);
m_page->partiallyComplete->setChecked(m_completion->isPartialCompletionEnabled()); m_page->partiallyComplete->setChecked(settings.m_partiallyComplete);
m_page->spaceAfterFunctionName->setChecked(m_completion->isSpaceAfterFunctionName()); m_page->spaceAfterFunctionName->setChecked(settings.m_spaceAfterFunctionName);
if (m_searchKeywords.isEmpty()) { if (m_searchKeywords.isEmpty()) {
QTextStream(&m_searchKeywords) << m_page->caseSensitivityLabel->text() QTextStream(&m_searchKeywords) << m_page->caseSensitivityLabel->text()
<< ' ' << m_page->autoInsertBrackets->text() << ' ' << m_page->autoInsertBrackets->text()
...@@ -88,15 +92,19 @@ QWidget *CompletionSettingsPage::createPage(QWidget *parent) ...@@ -88,15 +92,19 @@ QWidget *CompletionSettingsPage::createPage(QWidget *parent)
<< ' ' << m_page->spaceAfterFunctionName->text(); << ' ' << m_page->spaceAfterFunctionName->text();
m_searchKeywords.remove(QLatin1Char('&')); m_searchKeywords.remove(QLatin1Char('&'));
} }
return w; return w;
} }
void CompletionSettingsPage::apply() void CompletionSettingsPage::apply()
{ {
m_completion->setCaseSensitivity(caseSensitivity()); TextEditor::CompletionSettings settings;
m_completion->setAutoInsertBrackets(m_page->autoInsertBrackets->isChecked()); settings.m_caseSensitivity = caseSensitivity();
m_completion->setPartialCompletionEnabled(m_page->partiallyComplete->isChecked()); settings.m_autoInsertBrackets = m_page->autoInsertBrackets->isChecked();
m_completion->setSpaceAfterFunctionName(m_page->spaceAfterFunctionName->isChecked()); settings.m_partiallyComplete = m_page->partiallyComplete->isChecked();
settings.m_spaceAfterFunctionName = m_page->spaceAfterFunctionName->isChecked();
TextEditor::TextEditorSettings::instance()->setCompletionSettings(settings);
} }
bool CompletionSettingsPage::matches(const QString &s) const bool CompletionSettingsPage::matches(const QString &s) const
...@@ -104,14 +112,14 @@ bool CompletionSettingsPage::matches(const QString &s) const ...@@ -104,14 +112,14 @@ bool CompletionSettingsPage::matches(const QString &s) const
return m_searchKeywords.contains(s, Qt::CaseInsensitive); return m_searchKeywords.contains(s, Qt::CaseInsensitive);
} }
CppCodeCompletion::CaseSensitivity CompletionSettingsPage::caseSensitivity() const TextEditor::CaseSensitivity CompletionSettingsPage::caseSensitivity() const
{ {
switch (m_page->caseSensitivity->currentIndex()) { switch (m_page->caseSensitivity->currentIndex()) {
case 0: // Full case 0: // Full
return CppCodeCompletion::CaseSensitive; return TextEditor::CaseSensitive;
case 1: // None case 1: // None
return CppCodeCompletion::CaseInsensitive; return TextEditor::CaseInsensitive;
default: // First letter default: // First letter
return CppCodeCompletion::FirstLetterCaseSensitive; return TextEditor::FirstLetterCaseSensitive;
} }
} }
...@@ -30,10 +30,9 @@ ...@@ -30,10 +30,9 @@
#ifndef COMPLETIONSETTINGSPAGE_H #ifndef COMPLETIONSETTINGSPAGE_H
#define COMPLETIONSETTINGSPAGE_H #define COMPLETIONSETTINGSPAGE_H
#include <texteditor/completionsettings.h>
#include <texteditor/texteditoroptionspage.h> #include <texteditor/texteditoroptionspage.h>
#include "cppcodecompletion.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class Ui_CompletionSettingsPage; class Ui_CompletionSettingsPage;
QT_END_NAMESPACE QT_END_NAMESPACE
...@@ -41,12 +40,14 @@ QT_END_NAMESPACE ...@@ -41,12 +40,14 @@ QT_END_NAMESPACE
namespace CppTools { namespace CppTools {
namespace Internal { namespace Internal {
// TODO: Move this class to the text editor plugin
class CompletionSettingsPage : public TextEditor::TextEditorOptionsPage class CompletionSettingsPage : public TextEditor::TextEditorOptionsPage
{ {
Q_OBJECT Q_OBJECT
public: public:
CompletionSettingsPage(CppCodeCompletion *completion); CompletionSettingsPage();
~CompletionSettingsPage(); ~CompletionSettingsPage();
QString id() const; QString id() const;
...@@ -58,9 +59,8 @@ public: ...@@ -58,9 +59,8 @@ public:
virtual bool matches(const QString &) const; virtual bool matches(const QString &) const;
private: private:
CppCodeCompletion::CaseSensitivity caseSensitivity() const; TextEditor::CaseSensitivity caseSensitivity() const;
CppCodeCompletion *m_completion;
Ui_CompletionSettingsPage *m_page; Ui_CompletionSettingsPage *m_page;
QString m_searchKeywords; QString m_searchKeywords;
}; };
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <texteditor/completionsettings.h>
#include <texteditor/itexteditor.h> #include <texteditor/itexteditor.h>
#include <texteditor/itexteditable.h> #include <texteditor/itexteditable.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
...@@ -435,10 +436,6 @@ CppCodeCompletion::CppCodeCompletion(CppModelManager *manager) ...@@ -435,10 +436,6 @@ CppCodeCompletion::CppCodeCompletion(CppModelManager *manager)
m_manager(manager), m_manager(manager),
m_editor(0), m_editor(0),
m_startPosition(-1), m_startPosition(-1),
m_caseSensitivity(FirstLetterCaseSensitive),
m_autoInsertBrackets(true),
m_partialCompletionEnabled(true),
m_spaceAfterFunctionName(false),
m_forcedCompletion(false), m_forcedCompletion(false),
m_completionOperator(T_EOF_SYMBOL), m_completionOperator(T_EOF_SYMBOL),
m_objcEnabled(true) m_objcEnabled(true)
...@@ -450,46 +447,6 @@ QIcon CppCodeCompletion::iconForSymbol(Symbol *symbol) const ...@@ -450,46 +447,6 @@ QIcon CppCodeCompletion::iconForSymbol(Symbol *symbol) const
return m_icons.iconForSymbol(symbol); return m_icons.iconForSymbol(symbol);
} }
CppCodeCompletion::CaseSensitivity CppCodeCompletion::caseSensitivity() const
{
return m_caseSensitivity;
}
void CppCodeCompletion::setCaseSensitivity(CaseSensitivity caseSensitivity)
{
m_caseSensitivity = caseSensitivity;
}
bool CppCodeCompletion::autoInsertBrackets() const
{
return m_autoInsertBrackets;
}
void CppCodeCompletion::setAutoInsertBrackets(bool autoInsertBrackets)
{
m_autoInsertBrackets = autoInsertBrackets;
}
bool CppCodeCompletion::isPartialCompletionEnabled() const
{
return m_partialCompletionEnabled;
}
void CppCodeCompletion::setPartialCompletionEnabled(bool partialCompletionEnabled)
{
m_partialCompletionEnabled = partialCompletionEnabled;
}
bool CppCodeCompletion::isSpaceAfterFunctionName() const
{
return m_spaceAfterFunctionName;
}
void CppCodeCompletion::setSpaceAfterFunctionName(bool spaceAfterFunctionName)
{
m_spaceAfterFunctionName = spaceAfterFunctionName;
}
/* /*
Searches backwards for an access operator. Searches backwards for an access operator.
*/ */
...@@ -1459,7 +1416,7 @@ void CppCodeCompletion::completions(QList<TextEditor::CompletionItem> *completio ...@@ -1459,7 +1416,7 @@ void CppCodeCompletion::completions(QList<TextEditor::CompletionItem> *completio
return; return;
if (m_completionOperator != T_LPAREN) { if (m_completionOperator != T_LPAREN) {
filter(m_completions, completions, key, m_caseSensitivity); filter(m_completions, completions, key);
} else if (m_completionOperator == T_LPAREN || } else if (m_completionOperator == T_LPAREN ||
m_completionOperator == T_SIGNAL || m_completionOperator == T_SIGNAL ||
...@@ -1537,7 +1494,9 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) ...@@ -1537,7 +1494,9 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
//qDebug() << "current symbol:" << overview.prettyName(symbol->name()) //qDebug() << "current symbol:" << overview.prettyName(symbol->name())
//<< overview.prettyType(symbol->type()); //<< overview.prettyType(symbol->type());
if (m_autoInsertBrackets && symbol && symbol->type()) { const bool autoInsertBrackets = completionSettings().m_autoInsertBrackets;
if (autoInsertBrackets && symbol && symbol->type()) {
if (Function *function = symbol->type()->asFunctionType()) { if (Function *function = symbol->type()->asFunctionType()) {
// If the member is a function, automatically place the opening parenthesis, // If the member is a function, automatically place the opening parenthesis,
// except when it might take template parameters. // except when it might take template parameters.
...@@ -1550,7 +1509,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) ...@@ -1550,7 +1509,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
extraChars += QLatin1Char('<'); extraChars += QLatin1Char('<');
} }
} else if (! function->isAmbiguous()) { } else if (! function->isAmbiguous()) {
if (m_spaceAfterFunctionName) if (completionSettings().m_spaceAfterFunctionName)
extraChars += QLatin1Char(' '); extraChars += QLatin1Char(' ');
extraChars += QLatin1Char('('); extraChars += QLatin1Char('(');
...@@ -1578,7 +1537,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) ...@@ -1578,7 +1537,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
} }
} }
if (m_autoInsertBrackets && item.data.canConvert<CompleteFunctionDeclaration>()) { if (autoInsertBrackets && item.data.canConvert<CompleteFunctionDeclaration>()) {
// everything from the closing parenthesis on are extra chars, to // everything from the closing parenthesis on are extra chars, to
// make sure an auto-inserted ")" gets replaced by ") const" if necessary // make sure an auto-inserted ")" gets replaced by ") const" if necessary
int closingParen = toInsert.lastIndexOf(QLatin1Char(')')); int closingParen = toInsert.lastIndexOf(QLatin1Char(')'));
...@@ -1614,7 +1573,7 @@ bool CppCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem ...@@ -1614,7 +1573,7 @@ bool CppCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem
} else if (completionItems.count() == 1) { } else if (completionItems.count() == 1) {
complete(completionItems.first()); complete(completionItems.first());
return true; return true;
} else if (m_partialCompletionEnabled && m_completionOperator != T_LPAREN) { } else if (m_completionOperator != T_LPAREN) {
return TextEditor::ICompletionCollector::partiallyComplete(completionItems); return TextEditor::ICompletionCollector::partiallyComplete(completionItems);
} }
......
...@@ -79,18 +79,6 @@ public: ...@@ -79,18 +79,6 @@ public:
QIcon iconForSymbol(CPlusPlus::Symbol *symbol) const; QIcon iconForSymbol(CPlusPlus::Symbol *symbol) const;
CaseSensitivity caseSensitivity() const;
void setCaseSensitivity(CaseSensitivity caseSensitivity);
bool autoInsertBrackets() const;
void setAutoInsertBrackets(bool autoInsertBrackets);
bool isPartialCompletionEnabled() const;
void setPartialCompletionEnabled(bool partialCompletionEnabled);
bool isSpaceAfterFunctionName() const;
void setSpaceAfterFunctionName(bool spaceAfterFunctionName);
private: private:
void addKeywords(); void addKeywords();
void addMacros(const QString &fileName, const CPlusPlus::Snapshot &snapshot); void addMacros(const QString &fileName, const CPlusPlus::Snapshot &snapshot);
...@@ -152,10 +140,6 @@ private: ...@@ -152,10 +140,6 @@ private:
TextEditor::ITextEditable *m_editor; TextEditor::ITextEditable *m_editor;
int m_startPosition; // Position of the cursor from which completion started int m_startPosition; // Position of the cursor from which completion started
CaseSensitivity m_caseSensitivity;
bool m_autoInsertBrackets;
bool m_partialCompletionEnabled;
bool m_spaceAfterFunctionName;
bool m_forcedCompletion; bool m_forcedCompletion;
unsigned m_completionOperator; unsigned m_completionOperator;
bool m_objcEnabled; bool m_objcEnabled;
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/vcsmanager.h> #include <coreplugin/vcsmanager.h>
#include <coreplugin/filemanager.h> #include <coreplugin/filemanager.h>
#include <texteditor/texteditorsettings.h>
#include <cppeditor/cppeditorconstants.h> #include <cppeditor/cppeditorconstants.h>
#include <QtCore/QtConcurrentRun> #include <QtCore/QtConcurrentRun>
...@@ -109,8 +110,8 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) ...@@ -109,8 +110,8 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
m_modelManager, SLOT(updateSourceFiles(QStringList))); m_modelManager, SLOT(updateSourceFiles(QStringList)));
addAutoReleasedObject(m_modelManager); addAutoReleasedObject(m_modelManager);
m_completion = new CppCodeCompletion(m_modelManager); CppCodeCompletion *completion = new CppCodeCompletion(m_modelManager);
addAutoReleasedObject(m_completion); addAutoReleasedObject(completion);
CppLocatorFilter *locatorFilter = new CppLocatorFilter(m_modelManager, CppLocatorFilter *locatorFilter = new CppLocatorFilter(m_modelManager,
core->editorManager()); core->editorManager());
...@@ -118,7 +119,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) ...@@ -118,7 +119,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
addAutoReleasedObject(new CppClassesFilter(m_modelManager, core->editorManager())); addAutoReleasedObject(new CppClassesFilter(m_modelManager, core->editorManager()));
addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, core->editorManager())); addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, core->editorManager()));
addAutoReleasedObject(new CppCurrentDocumentFilter(m_modelManager, core->editorManager())); addAutoReleasedObject(new CppCurrentDocumentFilter(m_modelManager, core->editorManager()));
addAutoReleasedObject(new CompletionSettingsPage(m_completion)); addAutoReleasedObject(new CompletionSettingsPage);
addAutoReleasedObject(new CppFileSettingsPage(m_fileSettings)); addAutoReleasedObject(new CppFileSettingsPage(m_fileSettings));
// Menus // Menus
...@@ -139,17 +140,11 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) ...@@ -139,17 +140,11 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
mcpptools->addAction(command); mcpptools->addAction(command);
connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource())); connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource()));
// Restore settings // Set completion settings and keep them up to date
QSettings *settings = Core::ICore::instance()->settings(); TextEditor::TextEditorSettings *textEditorSettings = TextEditor::TextEditorSettings::instance();
settings->beginGroup(QLatin1String("CppTools")); completion->setCompletionSettings(textEditorSettings->completionSettings());
settings->beginGroup(QLatin1String("Completion")); connect(textEditorSettings, SIGNAL(completionSettingsChanged(TextEditor::CompletionSettings)),
const int caseSensitivity = settings->value(QLatin1String("CaseSensitivity"), m_completion->caseSensitivity()).toInt(); completion, SLOT(setCompletionSettings(TextEditor::CompletionSettings)));
m_completion->setCaseSensitivity((CppCodeCompletion::CaseSensitivity) caseSensitivity);
m_completion->setAutoInsertBrackets(settings->value(QLatin1String("AutoInsertBraces"), true).toBool());
m_completion->setPartialCompletionEnabled(settings->value(QLatin1String("PartiallyComplete"), true).toBool());
m_completion->setSpaceAfterFunctionName(settings->value(QLatin1String("SpaceAfterFunctionName"), false).toBool());
settings->endGroup();
settings->endGroup();
return true; return true;
} }
...@@ -170,16 +165,6 @@ void CppToolsPlugin::extensionsInitialized() ...@@ -170,16 +165,6 @@ void CppToolsPlugin::extensionsInitialized()
void CppToolsPlugin::aboutToShutdown() void CppToolsPlugin::aboutToShutdown()
{ {
// Save settings
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(QLatin1String("CppTools"));
settings->beginGroup(QLatin1String("Completion"));
settings->setValue(QLatin1String("CaseSensitivity"), (int) m_completion->caseSensitivity());
settings->setValue(QLatin1String("AutoInsertBraces"), m_completion->autoInsertBrackets());
settings->setValue(QLatin1String("PartiallyComplete"), m_completion->isPartialCompletionEnabled());
settings->setValue(QLatin1String("SpaceAfterFunctionName"), m_completion->isSpaceAfterFunctionName());
settings->endGroup();
settings->endGroup();
} }
void CppToolsPlugin::switchHeaderSource() void CppToolsPlugin::switchHeaderSource()
......
...@@ -50,7 +50,6 @@ QT_END_NAMESPACE ...@@ -50,7 +50,6 @@ QT_END_NAMESPACE
namespace CppTools { namespace CppTools {
namespace Internal { namespace Internal {
class CppCodeCompletion;
class CppModelManager; class CppModelManager;
struct CppFileSettings; struct CppFileSettings;
...@@ -79,7 +78,6 @@ private: ...@@ -79,7 +78,6 @@ private:
int m_context; int m_context;
CppModelManager *m_modelManager; CppModelManager *m_modelManager;
CppCodeCompletion *m_completion;
QSharedPointer<CppFileSettings> m_fileSettings; QSharedPointer<CppFileSettings> m_fileSettings;
static CppToolsPlugin *m_instance; static CppToolsPlugin *m_instance;
......
...@@ -477,8 +477,7 @@ CodeCompletion::CodeCompletion(ModelManagerInterface *modelManager, QObject *par ...@@ -477,8 +477,7 @@ CodeCompletion::CodeCompletion(ModelManagerInterface *modelManager, QObject *par
: TextEditor::ICompletionCollector(parent), : TextEditor::ICompletionCollector(parent),
m_modelManager(modelManager), m_modelManager(modelManager),
m_editor(0), m_editor(0),
m_startPosition(0), m_startPosition(0)
m_caseSensitivity(Qt::CaseSensitive)
{ {
Q_ASSERT(modelManager); Q_ASSERT(modelManager);
} }
...@@ -486,12 +485,6 @@ CodeCompletion::CodeCompletion(ModelManagerInterface *modelManager, QObject *par ...@@ -486,12 +485,6 @@ CodeCompletion::CodeCompletion(ModelManagerInterface *modelManager, QObject *par
CodeCompletion::~CodeCompletion() CodeCompletion::~CodeCompletion()
{ } { }
Qt::CaseSensitivity CodeCompletion::caseSensitivity() const
{ return m_caseSensitivity; }
void CodeCompletion::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity)
{ m_caseSensitivity = caseSensitivity; }
TextEditor::ITextEditable *CodeCompletion::editor() const TextEditor::ITextEditable *CodeCompletion::editor() const
{ return m_editor; } { return m_editor; }
...@@ -854,7 +847,7 @@ void CodeCompletion::completions(QList<TextEditor::CompletionItem> *completions) ...@@ -854,7 +847,7 @@ void CodeCompletion::completions(QList<TextEditor::CompletionItem> *completions)
else if (length > 0) { else if (length > 0) {
const QString key = m_editor->textAt(m_startPosition, length); const QString key = m_editor->textAt(m_startPosition, length);
filter(m_completions, completions, key, FirstLetterCaseSensitive); filter(m_completions, completions, key);
if (completions->size() == 1) { if (completions->size() == 1) {
if (key == completions->first().text) if (key == completions->first().text)
......
...@@ -55,9 +55,6 @@ public: ...@@ -55,9 +55,6 @@ public:
CodeCompletion(ModelManagerInterface *modelManager, QObject *parent = 0); CodeCompletion(ModelManagerInterface *modelManager, QObject *parent = 0);
virtual ~CodeCompletion(); virtual ~CodeCompletion();
Qt::CaseSensitivity caseSensitivity() const;
void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity);
virtual TextEditor::ITextEditable *editor() const; virtual TextEditor::ITextEditable *editor() const;
virtual int startPosition() const; virtual int startPosition() const;
virtual bool shouldRestartCompletion(); virtual bool shouldRestartCompletion();
...@@ -81,7 +78,6 @@ private: ...@@ -81,7 +78,6 @@ private:
TextEditor::ITextEditable *m_editor; TextEditor::ITextEditable *m_editor;
int m_startPosition; int m_startPosition;
QList<TextEditor::CompletionItem> m_completions; QList<TextEditor::CompletionItem> m_completions;
Qt::CaseSensitivity m_caseSensitivity;
QList<TextEditor::CompletionItem> m_snippets; QList<TextEditor::CompletionItem> m_snippets;
QDateTime m_snippetFileLastModified; QDateTime m_snippetFileLastModified;
......
...@@ -77,8 +77,7 @@ QmlJSEditorPlugin::QmlJSEditorPlugin() : ...@@ -77,8 +77,7 @@ QmlJSEditorPlugin::QmlJSEditorPlugin() :
m_modelManager(0), m_modelManager(0),
m_wizard(0), m_wizard(0),
m_editor(0), m_editor(0),
m_actionHandler(0), m_actionHandler(0)
m_completion(0)
{ {
m_instance = this; m_instance = this;
} }
...@@ -148,19 +147,16 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e ...@@ -148,19 +147,16 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION);
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
m_completion = new CodeCompletion(m_modelManager); CodeCompletion *completion = new CodeCompletion(m_modelManager);
addAutoReleasedObject(m_completion); addAutoReleasedObject(completion);
addAutoReleasedObject(new HoverHandler());