@@ -23,6 +23,9 @@ function! s:do()
2323 let l: server = l: servers [0 ]
2424 let has_provider = easycomplete#lsp#HasProvider (l: server , " hoverProvider" )
2525 if has_provider == 0
26+ if s: Has_Shift_K_Map ()
27+ exec " h " . expand (' <cword>' )
28+ endif
2629 return
2730 endif
2831
@@ -37,22 +40,40 @@ function! s:do()
3740 \ })
3841endfunction
3942
43+ function ! s: Has_Shift_K_Map ()
44+ let maps = execute (' map <s-k>' )
45+ if maps = ~ " EasyCompleteHover"
46+ return v: true
47+ else
48+ return v: false
49+ endif
50+ endfunction
51+
4052function ! s: HandleLspCallback (server, data) abort
4153 try
4254 if easycomplete#lsp#client#is_error (a: data [' response' ])
4355 call easycomplete#lsp#utils#error (' Failed ' . a: server )
4456 call s: flush ()
57+ if s: Has_Shift_K_Map ()
58+ exec " h " . expand (' <cword>' )
59+ endif
4560 return
4661 endif
4762
4863 if ! has_key (a: data [' response' ], ' result' )
4964 call s: flush ()
65+ if s: Has_Shift_K_Map ()
66+ exec " h " . expand (' <cword>' )
67+ endif
5068 return
5169 endif
5270
5371 let local_msg = s: get (a: data ," response" ," result" ," contents" ," value" )
5472 if empty (local_msg)
5573 call s: log (" No hover informations!" )
74+ if s: Has_Shift_K_Map ()
75+ exec " h " . expand (' <cword>' )
76+ endif
5677 return
5778 endif
5879 let content = substitute (local_msg, " ```\\ w\\ +" , " " , " g" )
@@ -61,6 +82,8 @@ function! s:HandleLspCallback(server, data) abort
6182 let content = s: RemoveTrailingEmptyStrings (content)
6283 if ! empty (content)
6384 call easycomplete#popup#float (content, ' Pmenu' , 0 , " " , [0 , 0 ], ' signature' )
85+ elseif s: Has_Shift_K_Map ()
86+ exec " h " . expand (' <cword>' )
6487 endif
6588 return
6689 catch
0 commit comments