Clang: Show full completion match first

If prefix is equal to some completion then show it
before anything else.

Task-number: QTCREATORBUG-15445
Change-Id: I976da4a829b818e843d31a76d2818eb5bbedda93
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2017-06-09 09:55:00 +02:00
parent 8922fbf4be
commit 48392fac9e
2 changed files with 7 additions and 4 deletions

View File

@@ -47,9 +47,10 @@ public:
// We compare proposals by enum values, be careful changing their values
enum class PrefixMatch
{
Exact = 0,
Lower = 1,
None = 2
Full = 0,
Exact = 1,
Lower = 2,
None = 3
};
AssistProposalItemInterface() = default;

View File

@@ -316,7 +316,9 @@ void GenericProposalModel::filter(const QString &prefix)
m_currentItems.append(item);
if (text.startsWith(prefix)) {
// Direct match
item->setPrefixMatch(AssistProposalItemInterface::PrefixMatch::Exact);
item->setPrefixMatch(text.length() == prefix.length()
? AssistProposalItemInterface::PrefixMatch::Full
: AssistProposalItemInterface::PrefixMatch::Exact);
continue;
}