fix(extras.ai): blink.cmp integration and menu drawing

This commit is contained in:
Stefan Boca 2024-12-02 16:33:30 -08:00
parent 4a626a8137
commit c6ae68259f
No known key found for this signature in database
4 changed files with 70 additions and 37 deletions

View file

@ -55,17 +55,32 @@ return {
end, end,
}, },
{ vim.g.ai_cmp and {
"saghen/blink.cmp", "saghen/blink.cmp",
optional = true, optional = true,
dependencies = { "codeium.nvim", "saghen/blink.compat" },
opts = { opts = {
sources = { sources = {
compat = vim.g.ai_cmp and { "codeium" } or nil, compat = { "codeium" },
},
completion = {
menu = {
draw = {
components = {
kind = {
text = function(ctx)
return ctx.source_name == "codeium" and "Codeium" or ctx.kind
end,
highlight = function(ctx)
return ctx.source_name == "codeium" and "BlinkCmpKindCodeium"
or require("blink.cmp.completion.windows.render.tailwind").get_hl(ctx)
or ("BlinkCmpKind" .. ctx.kind)
end,
},
},
},
},
}, },
}, },
dependencies = { } or nil,
"codeium.nvim",
vim.g.ai_cmp and "saghen/blink.compat" or nil,
},
},
} }

View file

@ -94,31 +94,37 @@ return {
}, },
}, },
-- blink.cmp vim.g.ai_cmp and {
{
"saghen/blink.cmp", "saghen/blink.cmp",
optional = true, optional = true,
dependencies = { dependencies = { "giuxtaposition/blink-cmp-copilot" },
{ opts = {
"giuxtaposition/blink-cmp-copilot", sources = {
enabled = vim.g.ai_cmp, -- only enable if needed completion = {
specs = { enabled_providers = { "copilot" },
{ },
"blink.cmp", providers = {
optional = true, copilot = { name = "copilot", module = "blink-cmp-copilot" },
opts = { },
sources = { },
providers = { completion = {
copilot = { name = "copilot", module = "blink-cmp-copilot" }, menu = {
}, draw = {
completion = { components = {
enabled_providers = { "copilot" }, kind = {
}, text = function(ctx)
return ctx.source_name == "copilot" and "Copilot" or ctx.kind
end,
highlight = function(ctx)
return ctx.source_name == "copilot" and "BlinkCmpKindCopilot"
or require("blink.cmp.completion.windows.render.tailwind").get_hl(ctx)
or ("BlinkCmpKind" .. ctx.kind)
end,
}, },
}, },
}, },
}, },
}, },
}, },
}, } or nil,
} }

View file

@ -43,22 +43,34 @@ return {
end, end,
}, },
-- blink.cmp integration vim.g.ai_cmp and {
{
"saghen/blink.cmp", "saghen/blink.cmp",
optional = true, optional = true,
---@module 'blink.cmp' dependencies = { "supermaven-nvim", "saghen/blink.compat" },
---@type blink.cmp.Config
opts = { opts = {
sources = { sources = {
compat = vim.g.ai_cmp and { "supermaven" } or nil, compat = { "supermaven" },
},
completion = {
menu = {
draw = {
components = {
kind = {
text = function(ctx)
return ctx.source_name == "supermaven" and "Supermaven" or ctx.kind
end,
highlight = function(ctx)
return ctx.source_name == "supermaven" and "BlinkCmpKindSupermaven"
or require("blink.cmp.completion.windows.render.tailwind").get_hl(ctx)
or ("BlinkCmpKind" .. ctx.kind)
end,
},
},
},
},
}, },
}, },
dependencies = { } or nil,
"supermaven-nvim",
vim.g.ai_cmp and "saghen/blink.compat" or nil,
},
},
{ {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",

View file

@ -52,7 +52,7 @@ return {
auto_show_delay_ms = 200, auto_show_delay_ms = 200,
}, },
ghost_text = { ghost_text = {
enabled = vim.g.ai_cmp, enabled = true,
}, },
}, },