diff --git a/lua/lazyvim/plugins/extras/ai/codeium.lua b/lua/lazyvim/plugins/extras/ai/codeium.lua index 21fc455a..dc42425c 100644 --- a/lua/lazyvim/plugins/extras/ai/codeium.lua +++ b/lua/lazyvim/plugins/extras/ai/codeium.lua @@ -63,13 +63,7 @@ return { sources = { compat = { "codeium" }, }, - completion = { - menu = { - draw = { - override_kind_by_source_name = { codeium = "Codeium" }, - }, - }, - }, + providers = { codeium = { kind = "Codeium" } }, }, } or nil, } diff --git a/lua/lazyvim/plugins/extras/ai/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua index 17c0cdb6..cfe54aa5 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot.lua @@ -104,13 +104,10 @@ return { enabled_providers = { "copilot" }, }, providers = { - copilot = { name = "copilot", module = "blink-cmp-copilot" }, - }, - }, - completion = { - menu = { - draw = { - override_kind_by_source_name = { copilot = "Copilot" }, + copilot = { + name = "copilot", + module = "blink-cmp-copilot", + kind = "Copilot", }, }, }, diff --git a/lua/lazyvim/plugins/extras/ai/supermaven.lua b/lua/lazyvim/plugins/extras/ai/supermaven.lua index 15c3b800..aca06a9a 100644 --- a/lua/lazyvim/plugins/extras/ai/supermaven.lua +++ b/lua/lazyvim/plugins/extras/ai/supermaven.lua @@ -51,13 +51,7 @@ return { sources = { compat = { "supermaven" }, }, - completion = { - menu = { - draw = { - override_kind_by_source_name = { supermaven = "Supermaven" }, - }, - }, - }, + providers = { supermaven = { kind = "Supermaven" } }, }, } or nil, diff --git a/lua/lazyvim/plugins/extras/ai/tabnine.lua b/lua/lazyvim/plugins/extras/ai/tabnine.lua index 9a45da0c..7c6af88b 100644 --- a/lua/lazyvim/plugins/extras/ai/tabnine.lua +++ b/lua/lazyvim/plugins/extras/ai/tabnine.lua @@ -42,13 +42,7 @@ return { sources = { compat = { "cmp_tabnine" }, }, - completion = { - menu = { - draw = { - override_kind_by_source_name = { cmp_tabnine = "TabNine" }, - }, - }, - }, + providers = { cmp_tabnine = { kind = "TabNine" } }, }, }, diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index 81165d09..c24d8c7d 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -45,7 +45,6 @@ return { completion = { menu = { draw = { - override_kind_by_source_name = {}, treesitter = true, }, }, @@ -96,22 +95,22 @@ return { end end - local override_kind_by_source_name = opts.completion.menu.draw.override_kind_by_source_name or {} - local kind = { - text = function(ctx) - local kind_override = override_kind_by_source_name[ctx.source_name] - return kind_override and kind_override or ctx.kind - end, - highlight = function(ctx) - local kind_override = override_kind_by_source_name[ctx.source_name] - return kind_override and "BlinkCmpKind" .. kind_override - or require("blink.cmp.completion.windows.render.tailwind").get_hl(ctx) - or ("BlinkCmpKind" .. ctx.kind) - end, - } + -- check if we need to override symbol kinds + for _, provider in pairs(opts.sources.providers or {}) do + ---@cast provider blink.cmp.SourceProviderConfig|{kind?:string} + if provider.kind then + require("blink.cmp.types").CompletionItemKind[provider.kind] = provider.kind + ---@param ctx blink.cmp.Context + ---@param items blink.cmp.CompletionItem[] + provider.transform_items = function(ctx, items) + for _, item in ipairs(items) do + item.kind = provider.kind or item.kind + end + return items + end + end + end - opts.completion.menu.draw.components = - vim.tbl_deep_extend("force", { kind = kind }, opts.completion.menu.draw.components or {}) require("blink.cmp").setup(opts) end, },