File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -535,18 +535,20 @@ function Snippet:get_completions(prefix)
535
535
local snippet_prefix_match = function (p )
536
536
for _ , item in ipairs (p ) do
537
537
if vim .startswith (item :lower (), prefix :lower ()) then
538
- return true
538
+ return item
539
539
end
540
540
end
541
- return false
541
+ return nil
542
542
end
543
543
544
544
local snippets = self .cache [ft ]
545
545
for trigger , snippet_data in pairs (snippets ) do
546
546
local snippet_prefix = type (snippet_data .prefix ) == ' string' and { snippet_data .prefix }
547
547
or snippet_data .prefix
548
+ local matched_label = snippet_prefix_match (snippet_prefix )
549
+
548
550
if
549
- snippet_prefix_match ( snippet_prefix )
551
+ matched_label
550
552
or (
551
553
vim .o .completeopt :find (' fuzzy' )
552
554
and next (vim .fn .matchfuzzy ({ snippet_prefix }, prefix :lower ())) ~= nil
@@ -560,7 +562,7 @@ function Snippet:get_completions(prefix)
560
562
end
561
563
562
564
table.insert (results , {
563
- label = snippet_prefix ,
565
+ label = matched_label or snippet_prefix ,
564
566
kind = 15 ,
565
567
filterText = snippet_prefix ,
566
568
insertText = insert_text ,
You can’t perform that action at this time.
0 commit comments