mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 17:03:39 +02:00
refactor(cmp): move comparator config to cmp spec
This commit is contained in:
parent
296d79cfbc
commit
27d3e45df6
2 changed files with 4 additions and 21 deletions
|
@ -44,6 +44,7 @@ return {
|
||||||
opts = function()
|
opts = function()
|
||||||
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
|
local defaults = require("cmp.config.default")()
|
||||||
return {
|
return {
|
||||||
completion = {
|
completion = {
|
||||||
completeopt = "menu,menuone,noinsert",
|
completeopt = "menu,menuone,noinsert",
|
||||||
|
@ -86,6 +87,7 @@ return {
|
||||||
hl_group = "CmpGhostText",
|
hl_group = "CmpGhostText",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
sorting = defaults.sorting,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
@ -70,28 +70,9 @@ return {
|
||||||
},
|
},
|
||||||
---@param opts cmp.ConfigSchema
|
---@param opts cmp.ConfigSchema
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local cmp = require("cmp")
|
|
||||||
|
|
||||||
table.insert(opts.sources, 1, { name = "copilot", group_index = 2 })
|
table.insert(opts.sources, 1, { name = "copilot", group_index = 2 })
|
||||||
|
opts.sorting = opts.sorting or require("cmp.config.default")().sorting
|
||||||
opts.sorting = {
|
table.insert(opts.sorting.comparators, 1, require("copilot_cmp.comparators").prioritize)
|
||||||
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