Skip to content

Commit 3bca7e8

Browse files
authored
Fix/showsigpreview (#1042)
* ensure l:bufferlines is defined when using preview window previously, when using the preview window to show signatures, the code failed with an stacktrace like: "s:on_stdout client request on_notification() error", "Vim(return):E121: Undefined variable: l:bufferlines", "function <SNR>118_out_cb[2].. <SNR>107_on_stdout[79].. <SNR>92_request_on_notification[3].. <SNR>93_createNext[1].. <SNR>93_subscribeSourceCallback[2].. <lambda>738[1].. <SNR>94_handle_signature_help[48].. lsp#ui#vim#output#preview[39].. lsp#ui#vim#output#get_size_info, line 22" This commit ensures that the required variable is properly defined in all the situations (popup, nvim, preview window) * removed superfluous return statement
1 parent db9b57b commit 3bca7e8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

autoload/lsp/ui/vim/output.vim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ function! lsp#ui#vim#output#get_size_info(winid) abort
284284
" Get size information while still having the buffer active
285285
let l:buffer = winbufnr(a:winid)
286286
let l:maxwidth = max(map(getbufline(l:buffer, 1, '$'), 'strdisplaywidth(v:val)'))
287+
let l:bufferlines = 0
287288
if g:lsp_preview_max_width > 0
288-
let l:bufferlines = 0
289289
let l:maxwidth = min([g:lsp_preview_max_width, l:maxwidth])
290290

291291
" Determine, for each line, how many "virtual" lines it spans, and add
@@ -303,7 +303,6 @@ function! lsp#ui#vim#output#get_size_info(winid) abort
303303
endif
304304

305305
return [l:bufferlines, l:maxwidth]
306-
return [l:bufferlines, l:maxwidth]
307306
endfunction
308307

309308
function! lsp#ui#vim#output#float_supported() abort

0 commit comments

Comments
 (0)