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.
This commit is contained in:
Lewis Russell
2024-11-14 11:53:20 +00:00
committed by Lewis Russell
parent f55c842ec7
commit 454ae672aa
19 changed files with 403 additions and 358 deletions

View File

@@ -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,