Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add try..catch as id as string is not supported by vim. #1538

Merged
merged 2 commits into from
Feb 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion autoload/lsp/client.vim
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,13 @@ function! lsp#client#send_response(client_id, opts) abort
if has_key(a:opts, 'id') | let l:request['id'] = a:opts['id'] | endif
if has_key(a:opts, 'result') | let l:request['result'] = a:opts['result'] | endif
if has_key(a:opts, 'error') | let l:request['error'] = a:opts['error'] | endif
call ch_sendexpr(l:ctx['channel'], l:request)
try
call ch_sendexpr(l:ctx['channel'], l:request)
catch
" vim only supports id as number and fails when string, hence add a try catch: https://github.com/vim/vim/issues/14091
call lsp#log('lsp#client#send_response error', v:exception, v:throwpoint,
\ has_key(l:request, 'id') && type(l:request['id']) != type(1))
endtry
return 0
else
return s:lsp_send(a:client_id, a:opts, s:send_type_response)
Expand Down
Loading