From c6535538f8717a8f6134020a5bee65341cf8280f Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 28 Sep 2026 14:19:42 +0100 Subject: fix(lua): enable param-type-mismatch diagnostic Problem: Argument type mismatches are excluded from EmmyLua checks. Solution: Correct runtime annotations and calls, document local checker workarounds, and enable the diagnostic. AI-assisted --- runtime/lua/vim/_watch.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/_watch.lua') diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index 08fd45046e..1313d6621b 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -122,6 +122,8 @@ local function emit(entry, method, ...) -- Callbacks can subscribe or cancel other subscriptions while handling an event. for _, subscriber in ipairs(vim.tbl_keys(entry.subscribers)) do if entry.subscribers[subscriber] then + -- EmmyLua rejects the union of callback signatures passed to pcall. + --- @diagnostic disable-next-line: param-type-mismatch local ok, err = pcall(subscriber[method], ...) if not ok then first_error = first_error or tostring(err) @@ -549,7 +551,7 @@ local function on_inotifywait_output(data, opts, callback) local d = vim.split(data, '%s+') -- only consider the last reported event - local path, event, file = d[1], d[2], d[#d] + local path, event, file = assert(d[1]), d[2], d[#d] local fullpath = vim.fs.joinpath(path, file) if skip(fullpath, opts) then -- cgit