fix: move opts cast after second tbl_deep_extend in render_buffer_async

Problem: the ---@cast opts -nil was placed after the first opts guard
but LuaLS loses narrowing at the second tbl_deep_extend on line 928,
causing a persistent need-check-nil warning at opts.refetch.

Solution: remove the redundant first opts = opts or {} guard (the
tbl_deep_extend already handles nil) and place the cast after the
second tbl_deep_extend where opts is actually used.
This commit is contained in:
Barrett Ruth 2026-02-20 20:51:39 -05:00
parent 6dcd9c0d8f
commit 181e735c3b
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -911,8 +911,6 @@ local pending_renders = {}
--- refetch nil|boolean Defaults to true
---@param caller_callback nil|fun(err: nil|string)
M.render_buffer_async = function(bufnr, opts, caller_callback)
opts = opts or {}
---@cast opts -nil
local function callback(err)
if not err then
vim.api.nvim_exec_autocmds(
@ -928,6 +926,7 @@ M.render_buffer_async = function(bufnr, opts, caller_callback)
opts = vim.tbl_deep_extend("keep", opts or {}, {
refetch = true,
})
---@cast opts -nil
if bufnr == 0 then
bufnr = vim.api.nvim_get_current_buf()
end