diff options
author | Matthieu Coudron <teto@users.noreply.github.com> | 2021-02-23 00:02:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-23 00:02:51 +0100 |
commit | 9d5f842807c56d6265a5557cbb4bf3e951210425 (patch) | |
tree | d7c48042e7fd357cd28da0e98a723e7f5cae0ce0 /test | |
parent | 46a58b74f49939c58931c79647d8ef24a160ac30 (diff) | |
download | rneovim-9d5f842807c56d6265a5557cbb4bf3e951210425.tar.gz rneovim-9d5f842807c56d6265a5557cbb4bf3e951210425.tar.bz2 rneovim-9d5f842807c56d6265a5557cbb4bf3e951210425.zip |
lsp: remove deprecated references to 'callbacks' (#13945)
vim.lsp.callbacks was deprecated a few months ago. This is a cleanup before the release.
Use vim.lsp.handlers instead.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/fixtures/fake-lsp-server.lua | 4 | ||||
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 24 |
2 files changed, 14 insertions, 14 deletions
diff --git a/test/functional/fixtures/fake-lsp-server.lua b/test/functional/fixtures/fake-lsp-server.lua index 252db88b6b..3bbb4c4517 100644 --- a/test/functional/fixtures/fake-lsp-server.lua +++ b/test/functional/fixtures/fake-lsp-server.lua @@ -70,11 +70,11 @@ local function expect_notification(method, params, ...) ..., "expect_notification", "message") end -local function expect_request(method, callback, ...) +local function expect_request(method, handler, ...) local req = read_message() assert_eq(method, req.method, ..., "expect_request", "method") - local err, result = callback(req.params) + local err, result = handler(req.params) respond(req.id, err, result) end diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index cec306eb39..b36bfdfd9b 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -41,10 +41,10 @@ local function fake_lsp_server_setup(test_name, timeout_ms) "-c", string.format("lua TIMEOUT = %d", timeout), "-c", "luafile "..fixture_filename, }; - callbacks = setmetatable({}, { + handlers = setmetatable({}, { __index = function(t, method) return function(...) - return vim.rpcrequest(1, 'callback', ...) + return vim.rpcrequest(1, 'handler', ...) end end; }); @@ -89,7 +89,7 @@ local function test_rpc_server(config) end return NIL end - if method == 'callback' then + if method == 'handler' then if config.on_callback then config.on_callback(unpack(args)) end @@ -205,7 +205,7 @@ describe('LSP', function() } test_rpc_server { test_name = "basic_init"; - on_init = function(client, _init_result) + on_init = function(client, _) -- client is a dummy object which will queue up commands to be run -- once the server initializes. It can't accept lua callbacks or -- other types that may be unserializable for now. @@ -386,7 +386,7 @@ describe('LSP', function() exec_lua([=[ BUFFER = vim.api.nvim_get_current_buf() lsp.buf_attach_client(BUFFER, TEST_RPC_CLIENT_ID) - vim.lsp.callbacks['textDocument/typeDefinition'] = function(err, method) + vim.lsp.handlers['textDocument/typeDefinition'] = function(err, method) vim.lsp._last_lsp_callback = { err = err; method = method } end vim.lsp._unsupported_method = function(method) @@ -425,7 +425,7 @@ describe('LSP', function() test_name = "capabilities_for_client_supports_method"; on_setup = function() exec_lua([=[ - vim.lsp.callbacks['textDocument/typeDefinition'] = function(err, method) + vim.lsp.handlers['textDocument/typeDefinition'] = function(err, method) vim.lsp._last_lsp_callback = { err = err; method = method } end vim.lsp._unsupported_method = function(method) @@ -897,8 +897,8 @@ describe('LSP', function() eq(0, code, "exit code", fake_lsp_logfile) eq(0, signal, "exit signal", fake_lsp_logfile) end; - on_callback = function(err, method, params, client_id) - eq(table.remove(expected_callbacks), {err, method, params, client_id}, "expected callback") + on_handler = function(err, method, params, client_id) + eq(table.remove(expected_callbacks), {err, method, params, client_id}, "expected handler") end; } end) @@ -1779,8 +1779,8 @@ describe('LSP', function() uri = "file:///src/main.rs" } } } - local callback = require'vim.lsp.handlers'['callHierarchy/outgoingCalls'] - callback(nil, nil, rust_analyzer_response) + local handler = require'vim.lsp.handlers'['callHierarchy/outgoingCalls'] + handler(nil, nil, rust_analyzer_response) return vim.fn.getqflist() ]=]) @@ -1851,8 +1851,8 @@ describe('LSP', function() } } } } - local callback = require'vim.lsp.handlers'['callHierarchy/incomingCalls'] - callback(nil, nil, rust_analyzer_response) + local handler = require'vim.lsp.handlers'['callHierarchy/incomingCalls'] + handler(nil, nil, rust_analyzer_response) return vim.fn.getqflist() ]=]) |