Skip to content

Commit

Permalink
Add try..catch as id as string is not supported by vim. (#1538)
Browse files Browse the repository at this point in the history
* Add try..catch as id as string is not supported by vim.
vim/vim#14091
  • Loading branch information
prabirshrestha authored Feb 25, 2024
1 parent 2829332 commit b132b6a
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit b132b6a

Please sign in to comment.