Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit 7fd28f9

Browse files
committed
feat: add appropreiate matching priority
feat: add matching priority
1 parent a639df2 commit 7fd28f9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lua/completion/matching.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,20 @@ local matching_strategy = {
4848

4949
M.matching = function(complete_items, prefix, item)
5050
local matcher_list = vim.b.completion_matching_strategy_list or vim.g.completion_matching_strategy_list
51-
local matching_piroity = 1
51+
local matching_priority = 2
5252
for _, method in ipairs(matcher_list) do
5353
local is_match, score = matching_strategy[method](prefix, item.word)
5454
if is_match then
55-
item.user_data.matching_piroity = matching_piroity
5655
item.score = score
56+
if item.priority ~= nil then
57+
item.priority = item.priority + 10*matching_priority
58+
else
59+
item.priority = 10*matching_priority
60+
end
5761
util.addCompletionItems(complete_items, item)
5862
break
5963
end
64+
matching_priority = matching_priority - 1
6065
end
6166
end
6267

0 commit comments

Comments
 (0)