Clang: Move the majority of completion items sorting to ClangBackend

With this change ClangCodeModel only needs to sort completions by prefix.

Also some other optimization have become possible and are implemented here:
1. Getting completions after '{' for constructor overloads by replacing
   it with '(' inside usaved file.
2. Checking for all overloads requires only previous item check because
   all Class completions are already sorted to go before all CXXConstructor
   completions. Since they are not mixed no extra search is required.

Change-Id: Ie0187ad96a20857a63c1d71ddec74606b803f572
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-09-27 15:50:12 +02:00
parent 931ec39f64
commit efc39304a1
10 changed files with 262 additions and 104 deletions

View File

@@ -56,11 +56,7 @@ void ClangAssistProposalModel::sort(const QString &/*prefix*/)
return static_cast<int>(first->prefixMatch())
< static_cast<int>(second->prefixMatch());
}
if (first->requiresFixIts() != second->requiresFixIts())
return first->requiresFixIts() < second->requiresFixIts();
return (first->order() > 0
&& (first->order() < second->order()
|| (first->order() == second->order() && first->text() < second->text())));
return false;
};
// Keep the order for the items with the same priority and name.