mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 00:49:03 +02:00
feat(cmp): removed priority comparator in favor of source priorities for copilot/codeium
This commit is contained in:
parent
302c1ff66e
commit
bff3a99697
3 changed files with 15 additions and 31 deletions
|
@ -45,26 +45,6 @@ return {
|
||||||
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")()
|
local defaults = require("cmp.config.default")()
|
||||||
|
|
||||||
-- LazyVim extension to prioritise certain sources
|
|
||||||
defaults.sorting.primary = {}
|
|
||||||
|
|
||||||
---@param entry Cmp.Entry
|
|
||||||
local function is_primary(entry)
|
|
||||||
local config = require("cmp.config").global
|
|
||||||
return vim.tbl_contains(config.sorting.primary or {}, entry.source:get_debug_name())
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(defaults.sorting.comparators, 1, function(a, b)
|
|
||||||
local aa = is_primary(a)
|
|
||||||
local bb = is_primary(b)
|
|
||||||
if aa and not bb then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
if not aa and bb then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
return {
|
return {
|
||||||
completion = {
|
completion = {
|
||||||
completeopt = "menu,menuone,noinsert",
|
completeopt = "menu,menuone,noinsert",
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
return {
|
return {
|
||||||
|
|
||||||
-- codeium
|
|
||||||
{
|
|
||||||
"Exafunction/codeium.nvim",
|
|
||||||
cmd = "Codeium",
|
|
||||||
build = ":Codeium Auth",
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
-- codeium cmp source
|
-- codeium cmp source
|
||||||
{
|
{
|
||||||
"nvim-cmp",
|
"nvim-cmp",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
-- codeium
|
||||||
{
|
{
|
||||||
"Exafunction/codeium.nvim",
|
"Exafunction/codeium.nvim",
|
||||||
|
cmd = "Codeium",
|
||||||
|
build = ":Codeium Auth",
|
||||||
|
opts = {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
---@param opts cmp.ConfigSchema
|
---@param opts cmp.ConfigSchema
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
table.insert(opts.sources, 1, { name = "codeium", group_index = 1 })
|
table.insert(opts.sources, 1, {
|
||||||
table.insert(opts.sorting.primary, "codeium")
|
name = "codeium",
|
||||||
|
group_index = 1,
|
||||||
|
priority = 100,
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,11 @@ return {
|
||||||
},
|
},
|
||||||
---@param opts cmp.ConfigSchema
|
---@param opts cmp.ConfigSchema
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
table.insert(opts.sources, 1, { name = "copilot", group_index = 1 })
|
table.insert(opts.sources, 1, {
|
||||||
table.insert(opts.sorting.primary, "copilot")
|
name = "copilot",
|
||||||
|
group_index = 1,
|
||||||
|
priority = 100,
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue