mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 11:18:19 +00:00
Co-authored-by: Jesse <github@jessebakker.com>
(cherry picked from commit 29c72cdf4a
)
This commit is contained in:
@@ -945,6 +945,39 @@ describe('LSP', function()
|
||||
}
|
||||
end)
|
||||
|
||||
it('should forward ServerCancelled to callback', function()
|
||||
local expected_handlers = {
|
||||
{ NIL, {}, { method = 'finish', client_id = 1 } },
|
||||
{
|
||||
{ code = -32802 },
|
||||
NIL,
|
||||
{ method = 'error_code_test', bufnr = 1, client_id = 1 },
|
||||
},
|
||||
}
|
||||
local client --- @type vim.lsp.Client
|
||||
test_rpc_server {
|
||||
test_name = 'check_forward_server_cancelled',
|
||||
on_init = function(_client)
|
||||
_client.request('error_code_test')
|
||||
client = _client
|
||||
end,
|
||||
on_exit = function(code, signal)
|
||||
eq(0, code, 'exit code')
|
||||
eq(0, signal, 'exit signal')
|
||||
eq(0, #expected_handlers, 'did not call expected handler')
|
||||
end,
|
||||
on_handler = function(err, _, ctx)
|
||||
eq(table.remove(expected_handlers), { err, _, ctx }, 'expected handler')
|
||||
if ctx.method ~= 'finish' then
|
||||
client.notify('finish')
|
||||
end
|
||||
if ctx.method == 'finish' then
|
||||
client.stop()
|
||||
end
|
||||
end,
|
||||
}
|
||||
end)
|
||||
|
||||
it('should forward ContentModified to callback', function()
|
||||
local expected_handlers = {
|
||||
{ NIL, {}, { method = 'finish', client_id = 1 } },
|
||||
@@ -964,7 +997,6 @@ describe('LSP', function()
|
||||
end,
|
||||
on_handler = function(err, _, ctx)
|
||||
eq(table.remove(expected_handlers), { err, _, ctx }, 'expected handler')
|
||||
-- if ctx.method == 'error_code_test' then client.notify("finish") end
|
||||
if ctx.method ~= 'finish' then
|
||||
client.notify('finish')
|
||||
end
|
||||
|
Reference in New Issue
Block a user