Skip to content

Commit 860dcab

Browse files
send server requests to stream (#918)
* send server requests to stream * comment out method not found
1 parent c81bb11 commit 860dcab

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

autoload/lsp.vim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,15 +760,22 @@ endfunction
760760

761761
function! s:on_request(server_name, id, request) abort
762762
call lsp#log_verbose('<---', a:id, a:request)
763+
764+
let l:stream_data = { 'server': a:server_name, 'request': a:request }
765+
call s:Stream(1, l:stream_data) " notify stream before callbacks
766+
763767
if a:request['method'] ==# 'workspace/applyEdit'
764768
call lsp#utils#workspace_edit#apply_workspace_edit(a:request['params']['edit'])
765769
call s:send_response(a:server_name, { 'id': a:request['id'], 'result': { 'applied': v:true } })
766770
elseif a:request['method'] ==# 'workspace/configuration'
767771
let l:response_items = map(a:request['params']['items'], { key, val -> lsp#utils#workspace_config#get_value(a:server_name, val) })
768772
call s:send_response(a:server_name, { 'id': a:request['id'], 'result': l:response_items })
769773
else
770-
" Error returned according to json-rpc specification.
771-
call s:send_response(a:server_name, { 'id': a:request['id'], 'error': { 'code': -32601, 'message': 'Method not found' } })
774+
" TODO: for now comment this out until we figure out a better solution.
775+
" We need to comment this out so that others outside of vim-lsp can
776+
" hook into the stream and provide their own response.
777+
" " Error returned according to json-rpc specification.
778+
" call s:send_response(a:server_name, { 'id': a:request['id'], 'error': { 'code': -32601, 'message': 'Method not found' } })
772779
endif
773780
endfunction
774781

0 commit comments

Comments
 (0)