From c30f2e3182e3b50e7c03932027ac55edfc8ada4a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 12 Jan 2024 12:44:54 +0000 Subject: test: typing for helpers.meths --- test/functional/helpers.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index a31d2d5b44..dff4a7f13c 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -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 -- cgit