mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 08:53:33 +02:00
feat(copilot): better sorting for cmp sources when using copilot
This commit is contained in:
parent
8f3834bc13
commit
23ba877bb0
1 changed files with 19 additions and 1 deletions
|
@ -36,7 +36,7 @@ return {
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
|
|
||||||
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "copilot" } }))
|
table.insert(opts.sources, 1, { name = "copilot", group_index = 2 })
|
||||||
|
|
||||||
local confirm = opts.mapping["<CR>"]
|
local confirm = opts.mapping["<CR>"]
|
||||||
local confirm_copilot = cmp.mapping.confirm({
|
local confirm_copilot = cmp.mapping.confirm({
|
||||||
|
@ -53,6 +53,24 @@ return {
|
||||||
return confirm(...)
|
return confirm(...)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
opts.sorting = {
|
||||||
|
priority_weight = 2,
|
||||||
|
comparators = {
|
||||||
|
require("copilot_cmp.comparators").prioritize,
|
||||||
|
|
||||||
|
-- Below is the default comparitor list and order for nvim-cmp
|
||||||
|
cmp.config.compare.offset,
|
||||||
|
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
|
||||||
|
cmp.config.compare.exact,
|
||||||
|
cmp.config.compare.score,
|
||||||
|
cmp.config.compare.recently_used,
|
||||||
|
cmp.config.compare.locality,
|
||||||
|
cmp.config.compare.kind,
|
||||||
|
cmp.config.compare.sort_text,
|
||||||
|
cmp.config.compare.length,
|
||||||
|
cmp.config.compare.order,
|
||||||
|
},
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue