Skip to content

Commit d11baa7

Browse files
Add try..catch as id as string is not supported by vim.
vim/vim#14091
1 parent 2829332 commit d11baa7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

autoload/lsp/client.vim

+7-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,13 @@ function! lsp#client#send_response(client_id, opts) abort
448448
if has_key(a:opts, 'id') | let l:request['id'] = a:opts['id'] | endif
449449
if has_key(a:opts, 'result') | let l:request['result'] = a:opts['result'] | endif
450450
if has_key(a:opts, 'error') | let l:request['error'] = a:opts['error'] | endif
451-
call ch_sendexpr(l:ctx['channel'], l:request)
451+
try
452+
call ch_sendexpr(l:ctx['channel'], l:request)
453+
catch
454+
" vim only supports id as number and fails when string, hence add a try catch: https://github.com/vim/vim/issues/14091
455+
call lsp#log('lsp#client#send_response error', v:exception, v:throwpoint,
456+
\ has_key(l:request, 'id') && type(l:request['id']) != 'number')
457+
endtry
452458
return 0
453459
else
454460
return s:lsp_send(a:client_id, a:opts, s:send_type_response)

0 commit comments

Comments
 (0)