aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp/testutil.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-11-14 11:53:20 +0000
committerLewis Russell <me@lewisr.dev>2024-11-20 08:51:45 +0000
commit454ae672aad172a299dcff7c33c5e61a3b631c90 (patch)
tree0a7116ed6967563ca724cc3169e4ec72f40b70c0 /test/functional/plugin/lsp/testutil.lua
parentf55c842ec7eabd2e12749411babdcadba47438bc (diff)
downloadrneovim-454ae672aad172a299dcff7c33c5e61a3b631c90.tar.gz
rneovim-454ae672aad172a299dcff7c33c5e61a3b631c90.tar.bz2
rneovim-454ae672aad172a299dcff7c33c5e61a3b631c90.zip
feat(lsp): deprecate non-method client functions
Deprecated: - `client.request()` -> `client:request()` - `client.request_sync()` -> `client:request_sync()` - `client.notify()` -> `client:notify()` - `client.cancel_request()` -> `client:cancel_request()` - `client.stop()` -> `client:stop()` - `client.is_stopped()` `client:is_stopped()` - `client.supports_method()` -> `client:supports_method()` - `client.on_attach()` -> `client:on_attach()` Fixed docgen to link class fields to the full function doc.
Diffstat (limited to 'test/functional/plugin/lsp/testutil.lua')
-rw-r--r--test/functional/plugin/lsp/testutil.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/functional/plugin/lsp/testutil.lua b/test/functional/plugin/lsp/testutil.lua
index a36cbac568..95fc22b96b 100644
--- a/test/functional/plugin/lsp/testutil.lua
+++ b/test/functional/plugin/lsp/testutil.lua
@@ -182,16 +182,17 @@ function M.test_rpc_server(config)
)
end
local client = setmetatable({}, {
- __index = function(_, name)
+ __index = function(t, name)
-- Workaround for not being able to yield() inside __index for Lua 5.1 :(
-- Otherwise I would just return the value here.
- return function(...)
+ return function(arg1, ...)
+ local ismethod = arg1 == t
return exec_lua(function(...)
- if type(_G.TEST_RPC_CLIENT[name]) == 'function' then
- return _G.TEST_RPC_CLIENT[name](...)
- else
- return _G.TEST_RPC_CLIENT[name]
+ local client = _G.TEST_RPC_CLIENT
+ if type(client[name]) == 'function' then
+ return client[name](ismethod and client or arg1, ...)
end
+ return client[name]
end, ...)
end
end,