From 642f74503854c4f494937daa9403f15949b27365 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 20 Feb 2026 20:34:59 -0500 Subject: [PATCH] fix: resolve pre-existing LuaLS typecheck warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: CI typecheck fails with 13 warnings — 11 need-check-nil in util.render_text (opts param annotated nil|table but guaranteed non-nil after tbl_deep_extend), 1 undefined-doc-param in view.render_buffer_async (annotation says "callback" but param is "caller_callback"), and 1 need-check-nil on opts in the same function. Solution: add ---@cast opts -nil after the tbl_deep_extend call, fix the param name in the doc annotation, and add opts = opts or {} guard. --- lua/oil/util.lua | 1 + lua/oil/view.lua | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/oil/util.lua b/lua/oil/util.lua index ac04328..37e73cc 100644 --- a/lua/oil/util.lua +++ b/lua/oil/util.lua @@ -582,6 +582,7 @@ M.render_text = function(bufnr, text, opts) h_align = "center", v_align = "center", }) + ---@cast opts -nil if not vim.api.nvim_buf_is_valid(bufnr) then return end diff --git a/lua/oil/view.lua b/lua/oil/view.lua index 136c798..a25917b 100644 --- a/lua/oil/view.lua +++ b/lua/oil/view.lua @@ -909,8 +909,9 @@ local pending_renders = {} ---@param bufnr integer ---@param opts nil|table --- refetch nil|boolean Defaults to true ----@param callback nil|fun(err: nil|string) +---@param caller_callback nil|fun(err: nil|string) M.render_buffer_async = function(bufnr, opts, caller_callback) + opts = opts or {} local function callback(err) if not err then vim.api.nvim_exec_autocmds(