Skip to content

Commit 6f5ae79

Browse files
committed
feat: add snippet indicator back to label on render
1 parent f4dcebf commit 6f5ae79

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lua/blink/cmp/config.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,12 @@ local config = {
420420
text = function(ctx) return ctx.label .. (ctx.label_detail or '') end,
421421
highlight = function(ctx)
422422
-- label and label details
423+
local label = ctx.label
423424
local highlights = {
424-
{ 0, #ctx.label, group = ctx.deprecated and 'BlinkCmpLabelDeprecated' or 'BlinkCmpLabel' },
425+
{ 0, #label, group = ctx.deprecated and 'BlinkCmpLabelDeprecated' or 'BlinkCmpLabel' },
425426
}
426427
if ctx.label_detail then
427-
table.insert(highlights, { #ctx.label, #ctx.label + #ctx.label_detail, group = 'BlinkCmpLabelDetail' })
428+
table.insert(highlights, { #label, #label + #ctx.label_detail, group = 'BlinkCmpLabelDetail' })
428429
end
429430

430431
-- characters matched on the label by the fuzzy matcher

lua/blink/cmp/windows/render/context.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function context.new(draw, item, matched_indices)
3737
local kind_icon = config.kind_icons[kind] or config.kind_icons.Field
3838
-- Some LSPs can return labels with newlines.
3939
-- Escape them to avoid errors in nvim_buf_set_lines when rendering the autocomplete menu.
40-
local label = item.label:gsub('\n', '\\n')
40+
local label = item.label:gsub('\n', '\\n') .. (kind == 'Snippet' and '~' or '')
4141
if config.nerd_font_variant == 'normal' then label = label:gsub('', '') end
4242

4343
return {

0 commit comments

Comments
 (0)