@@ -42,7 +42,6 @@ local function get_context_aware_snippets(item, completion_item, line_to_cursor)
42
42
end
43
43
local line = vim .api .nvim_get_current_line ()
44
44
local nextWord = line :sub (# line_to_cursor + 1 , # line_to_cursor + 1 )
45
- print (nextWord == " " or # nextWord == 0 )
46
45
if nextWord == " " or # nextWord == 0 then
47
46
return
48
47
else
@@ -53,6 +52,7 @@ local function get_context_aware_snippets(item, completion_item, line_to_cursor)
53
52
end
54
53
if matches ~= 0 then
55
54
item .word = word
55
+ item .user_data = {}
56
56
end
57
57
end
58
58
end
@@ -83,14 +83,6 @@ local function text_document_completion_list_to_complete_items(result, opt)
83
83
item .info = info
84
84
85
85
item .word = get_completion_word (completion_item , opt .prefix , opt .suffix )
86
- if opt .suffix ~= nil and # opt .suffix ~= 0 then
87
- local index = item .word :find (opt .suffix )
88
- if index ~= nil then
89
- local newWord = item .word
90
- newWord = newWord :sub (1 , index - 1 )
91
- item .word = newWord
92
- end
93
- end
94
86
item .user_data = {
95
87
lsp = {
96
88
completion_item = completion_item ,
@@ -99,6 +91,15 @@ local function text_document_completion_list_to_complete_items(result, opt)
99
91
local kind = protocol .CompletionItemKind [completion_item .kind ]
100
92
item .kind = customize_label [kind ] or kind
101
93
item .abbr = completion_item .label
94
+ if opt .suffix ~= nil and # opt .suffix ~= 0 then
95
+ local index = item .word :find (opt .suffix )
96
+ if index ~= nil then
97
+ local newWord = item .word
98
+ newWord = newWord :sub (1 , index - 1 )
99
+ item .word = newWord
100
+ item .user_data = {}
101
+ end
102
+ end
102
103
get_context_aware_snippets (item , completion_item , opt .line_to_cursor )
103
104
item .priority = vim .g .completion_items_priority [item .kind ]
104
105
item .menu = completion_item .detail or ' '
0 commit comments