Clang: change global completions order

Give CamelCase completions lower priority

Task-number: QTCREATORBUG-18319
Change-Id: I812d22616e8ab0e3d186bcf7a6a569de22be2a07
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2017-06-02 09:17:51 +02:00
parent f3cd5cdb7e
commit 8922fbf4be
3 changed files with 33 additions and 7 deletions

View File

@@ -34,7 +34,7 @@
namespace ClangCodeModel {
namespace Internal {
const int SORT_LIMIT = 30000;
constexpr int SORT_LIMIT = 30000;
ClangAssistProposalModel::ClangAssistProposalModel(
ClangBackEnd::CompletionCorrection neededCorrection)
@@ -58,9 +58,13 @@ void ClangAssistProposalModel::sort(const QString &/*prefix*/)
auto currentItemsCompare = [](AssistProposalItemInterface *first,
AssistProposalItemInterface *second) {
if (first->prefixMatch() != second->prefixMatch()) {
return static_cast<int>(first->prefixMatch())
< static_cast<int>(second->prefixMatch());
}
return (first->order() > 0
&& (first->order() < second->order()
|| (first->order() == second->order() && first->text() < second->text())));
|| (first->order() == second->order() && first->text() < second->text())));
};
std::sort(m_currentItems.begin(), m_currentItems.end(), currentItemsCompare);