autoload/handlers.vim | 38 +++++++++++++++++++------------------- diff --git a/autoload/handlers.vim b/autoload/handlers.vim index 6c2adaf0389d86739607b69ce5755d87eed04524..7eb74d0bfcbdb9890b9dd33b26d800303c8227ee 100644 --- a/autoload/handlers.vim +++ b/autoload/handlers.vim @@ -331,26 +331,26 @@ ErrMsg('Error: Unsupported hover contents (' .. reply.result.contents .. ')') return endif if lspOptions.hoverInPreview - silent! pedit HoverReply - wincmd P - setlocal buftype=nofile - setlocal bufhidden=delete - # If lsp server provide kind of hover reply and this kind is in syntaxs - # syported by vim, use it for file type of preview window. Else use - # type text by default. - if reply.result.contents->has_key('kind') -\ && !reply.result.contents.kind->empty() -\ && getcompletion('', 'filetype')->index(reply.result.content.kind) > -1 - exe 'setlocal ft=' .. reply.result.contents.kind - else - set setlocal ft=text - endif - deletebufline(bufnr(), 1, getbufinfo(bufnr())[0].linecount) - append(0, hoverText) - cursor(1, 1) - wincmd p + silent! pedit HoverReply + wincmd P + setlocal buftype=nofile + setlocal bufhidden=delete + # If lsp server provide kind of hover reply and this kind is in syntaxs + # syported by vim, use it for file type of preview window. Else use + # type text by default. + if reply.result.contents->has_key('kind') +\ && !reply.result.contents.kind->empty() +\ && getcompletion('', 'filetype')->index(reply.result.content.kind) > -1 + exe 'setlocal ft=' .. reply.result.contents.kind + else + set setlocal ft=text + endif + deletebufline(bufnr(), 1, getbufinfo(bufnr())[0].linecount) + append(0, hoverText) + cursor(1, 1) + wincmd p else - hoverText->popup_atcursor({moved: 'word'}) + hoverText->popup_atcursor({moved: 'word'}) endif enddef