This repository was archived by the owner on Oct 13, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,16 @@ M.getCompletionItems = function(_, _)
10
10
return M .items
11
11
end
12
12
13
- local function get_completion_word (item )
13
+ local function get_completion_word (item , prefix )
14
14
if item .textEdit ~= nil and item .textEdit ~= vim .NIL
15
15
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
17
23
elseif item .insertText ~= nil and item .insertText ~= vim .NIL then
18
24
return item .insertText
19
25
end
@@ -49,7 +55,7 @@ local function text_document_completion_list_to_complete_items(result, prefix)
49
55
end
50
56
item .info = info
51
57
52
- item .word = get_completion_word (completion_item )
58
+ item .word = get_completion_word (completion_item , prefix )
53
59
item .user_data = {
54
60
lsp = {
55
61
completion_item = completion_item
You can’t perform that action at this time.
0 commit comments