@@ -77,7 +77,7 @@ function! s:on_complete_done_after() abort
77
77
78
78
let l: completion_item = s: resolve_completion_item (l: completion_item , l: server_name )
79
79
80
- " apply textEdit or insertText(snippet) .
80
+ " clear completed string if need .
81
81
let l: expand_text = s: get_expand_text (l: completed_item , l: completion_item )
82
82
if strlen (l: expand_text ) > 0
83
83
call s: clear_inserted_text (
@@ -86,19 +86,6 @@ function! s:on_complete_done_after() abort
86
86
\ l: completed_item ,
87
87
\ l: completion_item
88
88
\ )
89
-
90
- if exists (' g:lsp_snippets_expand_snippet' ) && len (g: lsp_snippets_expand_snippet ) > 0
91
- " vim-lsp-snippets expects commit characters removed.
92
- call s: simple_expand_text (v: completed_item [' word' ])
93
- elseif exists (' g:lsp_snippet_expand' ) && len (g: lsp_snippet_expand ) > 0
94
- " other snippet integartion point.
95
- call g: lsp_snippet_expand [0 ]({
96
- \ ' snippet' : l: expand_text
97
- \ })
98
- else
99
- " expand text simply.
100
- call s: simple_expand_text (l: expand_text )
101
- endif
102
89
endif
103
90
104
91
" apply additionalTextEdits.
@@ -115,6 +102,20 @@ function! s:on_complete_done_after() abort
115
102
call setpos (' .' , l: pos )
116
103
endif
117
104
105
+
106
+ " expand textEdit or insertText.
107
+ if strlen (l: expand_text ) > 0
108
+ if exists (' g:lsp_snippet_expand' ) && len (g: lsp_snippet_expand ) > 0
109
+ " other snippet integartion point.
110
+ call g: lsp_snippet_expand [0 ]({
111
+ \ ' snippet' : l: expand_text
112
+ \ })
113
+ else
114
+ " expand text simply.
115
+ call s: simple_expand_text (l: expand_text )
116
+ endif
117
+ endif
118
+
118
119
doautocmd User lsp_complete_done
119
120
return ' '
120
121
endfunction
0 commit comments