refactor(nvim): improve cmp sorting
This commit is contained in:
parent
65f1d3c253
commit
c078cf6142
@ -341,15 +341,24 @@ return {
|
||||
sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = {
|
||||
require("cmp_fuzzy_buffer.compare"),
|
||||
compare.score,
|
||||
compare.offset,
|
||||
compare.locality,
|
||||
compare.recently_used,
|
||||
compare.score,
|
||||
require("cmp_fuzzy_buffer.compare"),
|
||||
compare.offset,
|
||||
compare.exact,
|
||||
compare.kind,
|
||||
compare.sort_text,
|
||||
compare.length,
|
||||
compare.order,
|
||||
-- Copied from cmp-under-comparator
|
||||
function(entry1, entry2)
|
||||
local _, entry1_under = entry1.completion_item.label:find "^_+"
|
||||
local _, entry2_under = entry2.completion_item.label:find "^_+"
|
||||
entry1_under = entry1_under or 0
|
||||
entry2_under = entry2_under or 0
|
||||
if entry1_under > entry2_under then
|
||||
return false
|
||||
elseif entry1_under < entry2_under then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user