-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhover.vim
33 lines (31 loc) · 1.04 KB
/
hover.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function Hover() abort
call ForceSync()
let l:hover = {
\ 'method':'textDocument/hover',
\ 'params': {
\ 'textDocument': {'uri': 'file://' . expand("%:p")},
\ 'position': {'line': getpos('.')[1]-1,
\ 'character': getpos('.')[2],
\}
\ }
\ }
call ch_sendexpr(g:lsp[&filetype]['channel'],l:hover,{'callback':'s:HoverCallback'})
endfunction
function! s:HoverCallback(channel,response) abort
echom 'HoverCallback'
echom a:response
let g:response = a:response
if a:response['result'] == v:null | echo 'null response' | return | endif
let l:hover_text = a:response['result']['contents']['value']
let l:options = {
\'border':[1,1,1,1],
\'highlight':'Normal',
\'borderhighlight': ['LineNr'],
\'borderchars': ['─', '│', '─', '│', '┌', '┐', '┘', '└'],
\'moved':'word'
\}
" 'borderchars':['-','|','-','|','+','+','+','+'],
let l:formated_text = split(l:hover_text, '\r\n\|\r\|\n', v:true)
call popup_atcursor(l:formated_text,l:options)
endfunction
"nnoremap K :call Hover()<CR>