From 74ad7714878b4c9e4372b01eb5d2e5d5071c1641 Mon Sep 17 00:00:00 2001 From: Stefan Boca Date: Wed, 11 Dec 2024 11:01:24 -0800 Subject: [PATCH] fix(blink): set kind to int, not string, if overriding when sorting completion results, blink compares kinds, which can result in an error if the kind is a string --- lua/lazyvim/plugins/extras/coding/blink.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index 234ede72..94ee6b9f 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -107,7 +107,12 @@ return { 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 + local CompletionItemKind = require("blink.cmp.types").CompletionItemKind + local kind_idx = #CompletionItemKind + 1 + + CompletionItemKind[kind_idx] = provider.kind + CompletionItemKind[provider.kind] = kind_idx + ---@type fun(ctx: blink.cmp.Context, items: blink.cmp.CompletionItem[]): blink.cmp.CompletionItem[] local transform_items = provider.transform_items ---@param ctx blink.cmp.Context @@ -115,7 +120,7 @@ return { provider.transform_items = function(ctx, items) items = transform_items and transform_items(ctx, items) or items for _, item in ipairs(items) do - item.kind = provider.kind or item.kind + item.kind = kind_idx or item.kind end return items end