fix: resolve pre-existing LuaLS typecheck warnings

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.
This commit is contained in:
Barrett Ruth 2026-02-20 20:34:59 -05:00
parent 209d631cb9
commit 642f745038
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
2 changed files with 3 additions and 1 deletions

View file

@ -582,6 +582,7 @@ M.render_text = function(bufnr, text, opts)
h_align = "center", h_align = "center",
v_align = "center", v_align = "center",
}) })
---@cast opts -nil
if not vim.api.nvim_buf_is_valid(bufnr) then if not vim.api.nvim_buf_is_valid(bufnr) then
return return
end end

View file

@ -909,8 +909,9 @@ local pending_renders = {}
---@param bufnr integer ---@param bufnr integer
---@param opts nil|table ---@param opts nil|table
--- refetch nil|boolean Defaults to true --- 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) M.render_buffer_async = function(bufnr, opts, caller_callback)
opts = opts or {}
local function callback(err) local function callback(err)
if not err then if not err then
vim.api.nvim_exec_autocmds( vim.api.nvim_exec_autocmds(