@@ -41,6 +41,7 @@ function! s:HandleLspCallback(server_name, plugin_name, data) abort
4141 " call s:console('<--', 'lsp response', reltimestr(reltime(g:xx)))
4242 if easycomplete#IsBacking () | return | endif
4343 let l: ctx = easycomplete#context ()
44+ let l: word = l: ctx [" typing" ]
4445 if easycomplete#lsp#client#is_error (a: data ) || ! has_key (a: data , ' response' ) ||
4546 \ ! has_key (a: data [' response' ], ' result' )
4647 call easycomplete#complete (a: plugin_name , l: ctx , l: ctx [' startcol' ], [])
@@ -52,22 +53,22 @@ function! s:HandleLspCallback(server_name, plugin_name, data) abort
5253 return
5354 endif
5455
55- let l: result = s: GetLspCompletionResult (a: server_name , a: data , a: plugin_name )
56+ let l: result = s: GetLspCompletionResult (a: server_name , a: data , a: plugin_name, l: word )
5657 let l: matches = l: result [' matches' ]
5758 let l: startcol = l: ctx [' startcol' ]
5859
5960 let l: matches = s: MatchResultFilterPipe (a: plugin_name , l: matches , l: ctx )
6061 call easycomplete#complete (a: plugin_name , l: ctx , l: startcol , l: matches )
6162endfunction
6263
63- function ! s: GetLspCompletionResult (server_name, data, plugin_name) abort
64+ function ! s: GetLspCompletionResult (server_name, data, plugin_name, word ) abort
6465 let l: result = a: data [' response' ][' result' ]
6566 let l: response = a: data [' response' ]
6667
6768 " 这里包含了 info document 和 matches
6869 let g: xx = reltime ()
6970 " 192 个元素,55 ms
70- let l: completion_result = easycomplete#util#GetVimCompletionItems (l: response , a: plugin_name )
71+ let l: completion_result = easycomplete#util#GetVimCompletionItems (l: response , a: plugin_name, a: word )
7172 " call s:console('<--', 'TODOTODOTODO', reltimestr(reltime(g:xx)), len(l:completion_result['items']))
7273 return {' matches' : l: completion_result [' items' ], ' incomplete' : l: completion_result [' incomplete' ] }
7374endfunction
0 commit comments