diff --git a/lua/lazyvim/plugins/extras/ai/codeium.lua b/lua/lazyvim/plugins/extras/ai/codeium.lua index aa0b72cc..21fc455a 100644 --- a/lua/lazyvim/plugins/extras/ai/codeium.lua +++ b/lua/lazyvim/plugins/extras/ai/codeium.lua @@ -66,18 +66,7 @@ return { 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, - }, - }, + override_kind_by_source_name = { codeium = "Codeium" }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/ai/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua index 1f9108e5..17c0cdb6 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot.lua @@ -110,18 +110,7 @@ return { completion = { menu = { draw = { - components = { - 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, - }, - }, + override_kind_by_source_name = { copilot = "Copilot" }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/ai/supermaven.lua b/lua/lazyvim/plugins/extras/ai/supermaven.lua index fbd60295..15c3b800 100644 --- a/lua/lazyvim/plugins/extras/ai/supermaven.lua +++ b/lua/lazyvim/plugins/extras/ai/supermaven.lua @@ -54,18 +54,7 @@ return { 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, - }, - }, + override_kind_by_source_name = { supermaven = "Supermaven" }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/ai/tabnine.lua b/lua/lazyvim/plugins/extras/ai/tabnine.lua index e1486453..9a45da0c 100644 --- a/lua/lazyvim/plugins/extras/ai/tabnine.lua +++ b/lua/lazyvim/plugins/extras/ai/tabnine.lua @@ -45,18 +45,7 @@ return { completion = { menu = { draw = { - components = { - kind = { - text = function(ctx) - return ctx.source_name == "cmp_tabnine" and "TabNine" or ctx.kind - end, - highlight = function(ctx) - return ctx.source_name == "cmp_tabnine" and "BlinkCmpKindTabNine" - or require("blink.cmp.completion.windows.render.tailwind").get_hl(ctx) - or ("BlinkCmpKind" .. ctx.kind) - end, - }, - }, + override_kind_by_source_name = { cmp_tabnine = "TabNine" }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index 85348438..410d5061 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -45,7 +45,10 @@ return { completion = { menu = { winblend = vim.o.pumblend, - draw = { treesitter = true }, + draw = { + override_kind_by_source_name = {}, + treesitter = true, + }, }, documentation = { auto_show = true, @@ -93,6 +96,23 @@ return { table.insert(enabled, source) 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, + } + + opts.completion.menu.draw.components = + vim.tbl_deep_extend("force", { kind = kind }, opts.completion.menu.draw.components or {}) require("blink.cmp").setup(opts) end, },