@@ -56,7 +56,7 @@ local function get_context_aware_snippets(item, completion_item, line_to_cursor)
5656 end
5757 end
5858 item .user_data = {}
59- local matches
59+ local matches , word
6060 word , matches = item .word :gsub (" %(.*%)$" , " " )
6161 if matches == 0 then
6262 word , matches = item .word :gsub (" <.*>$" , " " )
@@ -93,6 +93,7 @@ local function text_document_completion_list_to_complete_items(result, params)
9393
9494 item .word = get_completion_word (completion_item , params .prefix , params .suffix )
9595 item .word = item .word :gsub (' \n ' , ' ' )
96+ item .word = vim .trim (item .word )
9697 item .dup = opt .get_option (" items_duplicate" )[' lsp' ]
9798 item .user_data = {
9899 lsp = {
@@ -102,11 +103,11 @@ local function text_document_completion_list_to_complete_items(result, params)
102103 if protocol .InsertTextFormat [completion_item .insertTextFormat ] == ' Snippet'
103104 and opt .get_option (' enable_snippet' ) == " snippets.nvim" then
104105 item .user_data .actual_item = item .word
105- item .word = completion_item .label
106+ item .word = vim . trim ( completion_item .label )
106107 end
107108 local kind = protocol .CompletionItemKind [completion_item .kind ]
108109 item .kind = customize_label [kind ] or kind
109- item .abbr = completion_item .label
110+ item .abbr = vim . trim ( completion_item .label )
110111 if params .suffix ~= nil and # params .suffix ~= 0 then
111112 local index = item .word :find (params .suffix )
112113 if index ~= nil then
0 commit comments