Skip to content

Commit c8d95cd

Browse files
committed
fix(blink-cmp): use new kind_hl context
1 parent 3776217 commit c8d95cd

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lua/astrocommunity/completion/blink-cmp/init.lua

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,33 @@ local icon_provider, hl_provider
99
local function get_kind_icon(CTX)
1010
-- Evaluate icon provider
1111
if not icon_provider then
12-
local base = function(ctx) ctx.kind_icon_highlight = "BlinkCmpKind" .. ctx.kind end
1312
local _, mini_icons = pcall(require, "mini.icons")
1413
if _G.MiniIcons then
1514
icon_provider = function(ctx)
16-
base(ctx)
15+
local is_specific_color = ctx.kind_hl and ctx.kind_hl:match "^HexColor" ~= nil
1716
if ctx.item.source_name == "LSP" then
1817
local icon, hl = mini_icons.get("lsp", ctx.kind or "")
1918
if icon then
2019
ctx.kind_icon = icon
21-
ctx.kind_icon_highlight = hl
20+
if not is_specific_color then ctx.kind_hl = hl end
2221
end
2322
elseif ctx.item.source_name == "Path" then
24-
ctx.kind_icon, ctx.kind_icon_highlight =
25-
mini_icons.get(ctx.kind == "Folder" and "directory" or "file", ctx.label)
23+
ctx.kind_icon, ctx.kind_hl = mini_icons.get(ctx.kind == "Folder" and "directory" or "file", ctx.label)
2624
end
2725
end
2826
end
2927
if not icon_provider then
3028
local lspkind_avail, lspkind = pcall(require, "lspkind")
3129
if lspkind_avail then
3230
icon_provider = function(ctx)
33-
base(ctx)
3431
if ctx.item.source_name == "LSP" then
3532
local icon = lspkind.symbolic(ctx.kind, { mode = "symbol" })
3633
if icon then ctx.kind_icon = icon end
3734
end
3835
end
3936
end
4037
end
41-
if not icon_provider then icon_provider = function(ctx) base(ctx) end end
38+
if not icon_provider then icon_provider = function() end end
4239
end
4340
-- Evaluate highlight provider
4441
if not hl_provider then
@@ -53,7 +50,7 @@ local function get_kind_icon(CTX)
5350
local color_item = highlight_colors_avail and highlight_colors.format(doc, { kind = kinds[kinds.Color] })
5451
if color_item and color_item.abbr_hl_group then
5552
if color_item.abbr then ctx.kind_icon = color_item.abbr end
56-
ctx.kind_icon_highlight = color_item.abbr_hl_group
53+
ctx.kind_hl = color_item.abbr_hl_group
5754
end
5855
end
5956
end
@@ -65,7 +62,7 @@ local function get_kind_icon(CTX)
6562
icon_provider(CTX)
6663
hl_provider(CTX)
6764
-- Return text and highlight information
68-
return { text = CTX.kind_icon .. CTX.icon_gap, highlight = CTX.kind_icon_highlight }
65+
return { text = CTX.kind_icon .. CTX.icon_gap, highlight = CTX.kind_hl }
6966
end
7067

7168
return {

0 commit comments

Comments
 (0)