mirror of
https://github.com/prabirshrestha/vim-lsp.git
synced 2025-12-14 20:35:59 +01:00
send server requests to stream (#918)
* send server requests to stream * comment out method not found
This commit is contained in:
@@ -760,6 +760,10 @@ endfunction
|
||||
|
||||
function! s:on_request(server_name, id, request) abort
|
||||
call lsp#log_verbose('<---', a:id, a:request)
|
||||
|
||||
let l:stream_data = { 'server': a:server_name, 'request': a:request }
|
||||
call s:Stream(1, l:stream_data) " notify stream before callbacks
|
||||
|
||||
if a:request['method'] ==# 'workspace/applyEdit'
|
||||
call lsp#utils#workspace_edit#apply_workspace_edit(a:request['params']['edit'])
|
||||
call s:send_response(a:server_name, { 'id': a:request['id'], 'result': { 'applied': v:true } })
|
||||
@@ -767,8 +771,11 @@ function! s:on_request(server_name, id, request) abort
|
||||
let l:response_items = map(a:request['params']['items'], { key, val -> lsp#utils#workspace_config#get_value(a:server_name, val) })
|
||||
call s:send_response(a:server_name, { 'id': a:request['id'], 'result': l:response_items })
|
||||
else
|
||||
" Error returned according to json-rpc specification.
|
||||
call s:send_response(a:server_name, { 'id': a:request['id'], 'error': { 'code': -32601, 'message': 'Method not found' } })
|
||||
" TODO: for now comment this out until we figure out a better solution.
|
||||
" We need to comment this out so that others outside of vim-lsp can
|
||||
" hook into the stream and provide their own response.
|
||||
" " Error returned according to json-rpc specification.
|
||||
" call s:send_response(a:server_name, { 'id': a:request['id'], 'error': { 'code': -32601, 'message': 'Method not found' } })
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user