@@ -14,12 +14,14 @@ M.getUltisnipItems = function(prefix)
1414 end
1515 local priority = vim .g .completion_items_priority [' UltiSnips' ] or 1
1616 local kind = ' UltiSnips'
17+ local dup = opt .get_option (' items_duplicate' )[kind ] or 1
1718 kind = opt .get_option (' customize_lsp_label' )[kind ] or kind
1819 for key , val in pairs (snippetsList ) do
1920 local item = {}
2021 item .word = key
2122 item .kind = kind
2223 item .priority = priority
24+ item .dup = dup
2325 local user_data = {snippet_source = ' UltiSnips' , hover = val }
2426 item .user_data = user_data
2527 match .matching (complete_items , prefix , item )
@@ -36,6 +38,7 @@ M.getNeosnippetItems = function(prefix)
3638 end
3739 local kind = ' Neosnippet'
3840 kind = opt .get_option (' customize_lsp_label' )[kind ] or kind
41+ local dup = opt .get_option (' items_duplicate' )[kind ] or 1
3942 local priority = vim .g .completion_items_priority [' Neosnippet' ]
4043 for key , val in pairs (snippetsList ) do
4144 local description
@@ -45,6 +48,7 @@ M.getNeosnippetItems = function(prefix)
4548 item .word = key
4649 item .kind = kind
4750 item .priority = priority
51+ item .dup = dup
4852 item .user_data = user_data
4953 match .matching (complete_items , prefix , item )
5054 end
@@ -61,6 +65,7 @@ M.getVsnipItems = function(prefix)
6165 local kind = ' vim-vsnip'
6266 kind = opt .get_option (' customize_lsp_label' )[kind ] or kind
6367 local priority = vim .g .completion_items_priority [' vim-vsnip' ]
68+ local dup = opt .get_option (' items_duplicate' )[kind ] or 1
6469 for _ , source in pairs (snippetsList ) do
6570 for _ , snippet in pairs (source ) do
6671 for _ , word in pairs (snippet .prefix ) do
@@ -69,6 +74,7 @@ M.getVsnipItems = function(prefix)
6974 item .word = word
7075 item .kind = kind
7176 item .menu = snippet .label
77+ item .dup = dup
7278 item .priority = priority
7379 item .user_data = user_data
7480 match .matching (complete_items , prefix , item )
@@ -90,6 +96,7 @@ M.getSnippetsNvimItems = function(prefix)
9096 end
9197 local priority = vim .g .completion_items_priority [' snippets.nvim' ] or 1
9298 local kind = ' snippets.nvim'
99+ local dup = opt .get_option (' items_duplicate' )[kind ] or 1
93100 kind = opt .get_option (' customize_lsp_label' )[kind ] or kind
94101 for short , long in pairs (snippetsList ) do
95102 -- TODO: We cannot put the parsed snippet itself in userdata, since it may
@@ -99,6 +106,7 @@ M.getSnippetsNvimItems = function(prefix)
99106 local item = {}
100107 item .word = short
101108 item .kind = kind
109+ item .dup = dup
102110 -- TODO: Turn actual snippet text into label/description?
103111 item .menu = short
104112 item .priority = priority
0 commit comments