fix(compiler): hoist obj declaration before vim.system closure
Problem: lua-language-server flagged obj as an undefined global in both vim.schedule_wrap callbacks because local obj = vim.system(...) puts the variable out of scope inside the closure at declaration time. At runtime the guard active[bufnr].obj == obj evaluated obj as nil, so the clear was always skipped and the process remained tracked indefinitely. Solution: split into local obj / obj = vim.system(...) so the upvalue is in scope when the closure is defined.
This commit is contained in:
parent
4b1f95064f
commit
e53ddcad9a
1 changed files with 4 additions and 2 deletions
|
|
@ -91,7 +91,8 @@ function M.compile(bufnr, name, provider, ctx)
|
|||
table.concat(reload_cmd, ' ')
|
||||
)
|
||||
|
||||
local obj = vim.system(
|
||||
local obj
|
||||
obj = vim.system(
|
||||
reload_cmd,
|
||||
{
|
||||
cwd = cwd,
|
||||
|
|
@ -182,7 +183,8 @@ function M.compile(bufnr, name, provider, ctx)
|
|||
|
||||
log.dbg('compiling buffer %d with provider "%s": %s', bufnr, name, table.concat(cmd, ' '))
|
||||
|
||||
local obj = vim.system(
|
||||
local obj
|
||||
obj = vim.system(
|
||||
cmd,
|
||||
{
|
||||
cwd = cwd,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue