mirror of
https://github.com/prabirshrestha/vim-lsp.git
synced 2025-12-14 20:35:59 +01:00
refactor preview code (#1083)
This commit is contained in:
@@ -149,8 +149,8 @@ function! lsp#ui#vim#output#floatingpreview(data) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! lsp#ui#vim#output#setcontent(winid, lines, ft) abort
|
function! lsp#ui#vim#output#setcontent(winid, lines, ft) abort
|
||||||
if s:use_vim_popup || s:use_preview
|
if s:use_vim_popup
|
||||||
" vim popup or preview
|
" vim popup
|
||||||
call setbufline(winbufnr(a:winid), 1, a:lines)
|
call setbufline(winbufnr(a:winid), 1, a:lines)
|
||||||
call setbufvar(winbufnr(a:winid), '&filetype', a:ft . '.lsp-hover')
|
call setbufvar(winbufnr(a:winid), '&filetype', a:ft . '.lsp-hover')
|
||||||
elseif s:use_nvim_float
|
elseif s:use_nvim_float
|
||||||
@@ -160,6 +160,10 @@ function! lsp#ui#vim#output#setcontent(winid, lines, ft) abort
|
|||||||
call nvim_buf_set_option(winbufnr(a:winid), 'modifiable', v:false)
|
call nvim_buf_set_option(winbufnr(a:winid), 'modifiable', v:false)
|
||||||
call nvim_buf_set_option(winbufnr(a:winid), 'filetype', a:ft.'.lsp-hover')
|
call nvim_buf_set_option(winbufnr(a:winid), 'filetype', a:ft.'.lsp-hover')
|
||||||
call nvim_win_set_cursor(a:winid, [1, 0])
|
call nvim_win_set_cursor(a:winid, [1, 0])
|
||||||
|
elseif s:use_preview
|
||||||
|
" preview window
|
||||||
|
call setbufline(winbufnr(a:winid), 1, a:lines)
|
||||||
|
call setbufvar(winbufnr(a:winid), '&filetype', a:ft . '.lsp-hover')
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user