Commit 9e89f36c authored by Roberto Raggi's avatar Roberto Raggi
Browse files

There's no need to sort after filtering the completion.

parent 040e2a30
......@@ -445,6 +445,7 @@ CppCodeCompletion::CppCodeCompletion(CppModelManager *manager)
m_completionOperator(T_EOF_SYMBOL),
m_objcEnabled(true)
{
m_sorted = false;
}
QIcon CppCodeCompletion::iconForSymbol(Symbol *symbol) const
......@@ -654,6 +655,7 @@ bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
{
m_sorted = false;
TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor *>(editor->widget());
if (! edit)
return -1;
......@@ -1590,7 +1592,10 @@ QList<TextEditor::CompletionItem> CppCodeCompletion::getCompletions()
completions(&completionItems);
qStableSort(completionItems.begin(), completionItems.end(), completionItemLessThan);
if (! m_sorted) {
qStableSort(completionItems.begin(), completionItems.end(), completionItemLessThan);
m_sorted = true;
}
// Remove duplicates
QString lastKey;
......@@ -1736,6 +1741,7 @@ bool CppCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem
void CppCodeCompletion::cleanup()
{
m_sorted = false;
m_completions.clear();
// Set empty map in order to avoid referencing old versions of the documents
......
......@@ -147,6 +147,7 @@ private:
QPointer<FunctionArgumentWidget> m_functionArgumentWidget;
QList<TextEditor::CompletionItem> m_completions;
bool m_sorted;
};
} // namespace Internal
......
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