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:
parent
6dcd9c0d8f
commit
181e735c3b
1 changed files with 1 additions and 2 deletions
|
|
@ -911,8 +911,6 @@ local pending_renders = {}
|
||||||
--- refetch nil|boolean Defaults to true
|
--- refetch nil|boolean Defaults to true
|
||||||
---@param caller_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 {}
|
|
||||||
---@cast opts -nil
|
|
||||||
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(
|
||||||
|
|
@ -928,6 +926,7 @@ M.render_buffer_async = function(bufnr, opts, caller_callback)
|
||||||
opts = vim.tbl_deep_extend("keep", opts or {}, {
|
opts = vim.tbl_deep_extend("keep", opts or {}, {
|
||||||
refetch = true,
|
refetch = true,
|
||||||
})
|
})
|
||||||
|
---@cast opts -nil
|
||||||
if bufnr == 0 then
|
if bufnr == 0 then
|
||||||
bufnr = vim.api.nvim_get_current_buf()
|
bufnr = vim.api.nvim_get_current_buf()
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue