add lsp#notification() for proper $/cancel support (#1079)

This commit is contained in:
Prabir Shrestha
2021-02-28 13:47:45 -08:00
committed by GitHub
parent a78536ad74
commit ca2b527dc5

View File

@@ -1036,7 +1036,7 @@ function! s:request_cancel(ctx) abort
if lsp#get_server_status(a:ctx['server_name']) !=# 'running' | return | endif " if server is not running we cant send the request
" send the actual cancel request
let a:ctx['dispose'] = lsp#callbag#pipe(
\ lsp#request(a:ctx['server_name'], {
\ lsp#notification(a:ctx['server_name'], {
\ 'method': '$/cancelRequest',
\ 'params': { 'id': a:ctx['request_id'] },
\ }),
@@ -1076,6 +1076,12 @@ function! s:send_request_error(ctx, error) abort
endfunction
" }}}
" lsp#notification {{{
function! lsp#notification(server_name, request) abort
return lsp#callbag#lazy(function('s:send_notification', [a:server_name, a:request]))
endfunction
" }}}
" omnicompletion
function! lsp#complete(...) abort
return call('lsp#omni#complete', a:000)