From 7e4f7b8b647c961dd8fdcc9ced7a2f37c13138a0 Mon Sep 17 00:00:00 2001 From: yuukibarns Date: Tue, 25 Mar 2025 16:25:40 +0800 Subject: [PATCH] fix: prefer luasnip name over regex trigger in completion results --- lua/cmp_luasnip/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/cmp_luasnip/init.lua b/lua/cmp_luasnip/init.lua index 71bec54..69560ed 100644 --- a/lua/cmp_luasnip/init.lua +++ b/lua/cmp_luasnip/init.lua @@ -85,8 +85,8 @@ function source:complete(params, callback) for j, snip in pairs(tab) do if not snip.hidden then ft_items[#ft_items + 1] = { - word = snip.trigger, - label = snip.trigger, + word = snip.regTrig and snip.name or snip.trigger, + label = snip.regTrig and snip.name or snip.trigger, kind = cmp.lsp.CompletionItemKind.Snippet, data = { priority = snip.effective_priority or 1000, -- Default priority is used for old luasnip versions