completion: enable multiple completors for different use cases.

Introduce CompletionPolicy enum, use 'TextCompletion' for the new plain
text completion, and 'SemanticCompletion' or 'QuickFixCompletion' for
the existing cases.

Reviewed-by: Erik Verbruggen
This commit is contained in:
hjk
2011-02-21 14:02:00 +01:00
parent 43c980e6a3
commit 9a6c4a42f7
25 changed files with 135 additions and 93 deletions

View File

@@ -178,13 +178,11 @@ void CppPlugin::initializeEditor(CPPEditor *editor)
TextEditor::TextEditorSettings::instance()->initializeEditor(editor);
// auto completion
connect(editor, SIGNAL(requestAutoCompletion(TextEditor::ITextEditable*, bool)),
TextEditor::CompletionSupport::instance(), SLOT(autoComplete(TextEditor::ITextEditable*, bool)));
// quick fix
connect(editor, SIGNAL(requestQuickFix(TextEditor::ITextEditable*)),
this, SLOT(quickFix(TextEditor::ITextEditable*)));
// semantic auto completion and quick fix
connect(editor,
SIGNAL(requestCompletion(TextEditor::ITextEditable*,TextEditor::CompletionPolicy,bool)),
TextEditor::CompletionSupport::instance(),
SLOT(complete(TextEditor::ITextEditable*,TextEditor::CompletionPolicy,bool)));
// method combo box sorting
connect(this, SIGNAL(outlineSortingChanged(bool)),
@@ -408,7 +406,8 @@ void CppPlugin::quickFixNow()
if (editor->isOutdated())
m_quickFixTimer->start(QUICKFIX_INTERVAL);
else
TextEditor::CompletionSupport::instance()->quickFix(m_currentTextEditable);
TextEditor::CompletionSupport::instance()->
complete(m_currentTextEditable, TextEditor::QuickFixCompletion, true);
}
}
}