This repository was archived by the owner on Oct 13, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,10 +10,16 @@ M.getCompletionItems = function(_, _)
1010 return M .items
1111end
1212
13- local function get_completion_word (item )
13+ local function get_completion_word (item , prefix )
1414 if item .textEdit ~= nil and item .textEdit ~= vim .NIL
1515 and item .textEdit .newText ~= nil and (item .insertTextFormat ~= 2 or vim .fn .exists (' g:loaded_vsnip_integ' )) then
16- return item .textEdit .newText
16+ local start_range = item .textEdit .range [" start" ]
17+ local end_range = item .textEdit .range [" end" ]
18+ if start_range .line == end_range .line and start_range .character == end_range .character then
19+ return prefix .. item .textEdit .newText
20+ else
21+ return item .textEdit .newText
22+ end
1723 elseif item .insertText ~= nil and item .insertText ~= vim .NIL then
1824 return item .insertText
1925 end
@@ -49,7 +55,7 @@ local function text_document_completion_list_to_complete_items(result, prefix)
4955 end
5056 item .info = info
5157
52- item .word = get_completion_word (completion_item )
58+ item .word = get_completion_word (completion_item , prefix )
5359 item .user_data = {
5460 lsp = {
5561 completion_item = completion_item
You can’t perform that action at this time.
0 commit comments