Skip to content
Snippets Groups Projects
Commit 9e89f36c authored by Roberto Raggi's avatar Roberto Raggi
Browse files

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

parent 040e2a30
No related branches found
No related tags found
No related merge requests found
...@@ -445,6 +445,7 @@ CppCodeCompletion::CppCodeCompletion(CppModelManager *manager) ...@@ -445,6 +445,7 @@ CppCodeCompletion::CppCodeCompletion(CppModelManager *manager)
m_completionOperator(T_EOF_SYMBOL), m_completionOperator(T_EOF_SYMBOL),
m_objcEnabled(true) m_objcEnabled(true)
{ {
m_sorted = false;
} }
QIcon CppCodeCompletion::iconForSymbol(Symbol *symbol) const QIcon CppCodeCompletion::iconForSymbol(Symbol *symbol) const
...@@ -654,6 +655,7 @@ bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) ...@@ -654,6 +655,7 @@ bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
{ {
m_sorted = false;
TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor *>(editor->widget()); TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor *>(editor->widget());
if (! edit) if (! edit)
return -1; return -1;
...@@ -1590,7 +1592,10 @@ QList<TextEditor::CompletionItem> CppCodeCompletion::getCompletions() ...@@ -1590,7 +1592,10 @@ QList<TextEditor::CompletionItem> CppCodeCompletion::getCompletions()
completions(&completionItems); completions(&completionItems);
qStableSort(completionItems.begin(), completionItems.end(), completionItemLessThan); if (! m_sorted) {
qStableSort(completionItems.begin(), completionItems.end(), completionItemLessThan);
m_sorted = true;
}
// Remove duplicates // Remove duplicates
QString lastKey; QString lastKey;
...@@ -1736,6 +1741,7 @@ bool CppCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem ...@@ -1736,6 +1741,7 @@ bool CppCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem
void CppCodeCompletion::cleanup() void CppCodeCompletion::cleanup()
{ {
m_sorted = false;
m_completions.clear(); m_completions.clear();
// Set empty map in order to avoid referencing old versions of the documents // Set empty map in order to avoid referencing old versions of the documents
......
...@@ -147,6 +147,7 @@ private: ...@@ -147,6 +147,7 @@ private:
QPointer<FunctionArgumentWidget> m_functionArgumentWidget; QPointer<FunctionArgumentWidget> m_functionArgumentWidget;
QList<TextEditor::CompletionItem> m_completions; QList<TextEditor::CompletionItem> m_completions;
bool m_sorted;
}; };
} // namespace Internal } // namespace Internal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment