mirror of
https://github.com/neovim/neovim.git
synced 2025-11-19 16:51:18 +00:00
test: typing for helpers.meths
This commit is contained in:
@@ -631,6 +631,9 @@ module.uimeths = module.create_callindex(ui)
|
||||
local function create_api(request, call)
|
||||
local m = {}
|
||||
function m.nvim(method, ...)
|
||||
if vim.startswith(method, 'nvim_') then
|
||||
return request(method, ...)
|
||||
end
|
||||
return request('nvim_' .. method, ...)
|
||||
end
|
||||
|
||||
@@ -700,6 +703,9 @@ module.describe_lua_and_rpc = function(describe)
|
||||
end
|
||||
end
|
||||
|
||||
--- add for typing. The for loop after will overwrite this
|
||||
module.meths = vim.api
|
||||
|
||||
for name, fn in pairs(module.rpc.api) do
|
||||
module[name] = fn
|
||||
end
|
||||
@@ -862,11 +868,11 @@ function module.skip_fragile(pending_fn, cond)
|
||||
end
|
||||
|
||||
function module.exec(code)
|
||||
module.meths.exec2(code, {})
|
||||
module.meths.nvim_exec2(code, {})
|
||||
end
|
||||
|
||||
function module.exec_capture(code)
|
||||
return module.meths.exec2(code, { output = true }).output
|
||||
return module.meths.nvim_exec2(code, { output = true }).output
|
||||
end
|
||||
|
||||
--- @param code string
|
||||
|
||||
Reference in New Issue
Block a user