From eeca1712fde4fa301a0a53583308f4f9cfc2a5b8 Mon Sep 17 00:00:00 2001 From: xiaoshihou Date: Sat, 11 Oct 2025 16:01:16 +0100 Subject: [PATCH 1/2] fix: impure config reloading --- lua/guard/format.lua | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/lua/guard/format.lua b/lua/guard/format.lua index e116620..739bfd2 100644 --- a/lua/guard/format.lua +++ b/lua/guard/format.lua @@ -150,7 +150,7 @@ local function do_fmt(buf) if config.fn then return config.fn(buf, range, acc) else - local result = spawn.transform(util.get_cmd(config, fname, buf), cwd, config, acc) + local result = spawn.transform(util.get_cmd(config, fname), cwd, config, acc) if type(result) == 'table' then -- indicates error errno = result @@ -193,36 +193,36 @@ local function do_fmt(buf) -- wait until substitution is finished coroutine.yield() - impure:each(function(config) - if errno then - return - end - - vim.system(util.get_cmd(config, fname, buf), { - text = true, - cwd = cwd, - env = config.env or {}, - }, function(result) - if result.code ~= 0 and #result.stderr > 0 then - errno = result - ---@diagnostic disable-next-line: inject-field - errno.cmd = config.cmd - coroutine.resume(co) - else - coroutine.resume(co) + if impure and #impure:totable() > 0 then + impure:each(function(config) + if errno then + return end - end) - coroutine.yield() - end) + vim.system(util.get_cmd(config, fname), { + text = true, + cwd = cwd, + env = config.env or {}, + }, function(result) + if result.code ~= 0 and #result.stderr > 0 then + errno = result + ---@diagnostic disable-next-line: inject-field + errno.cmd = config.cmd + coroutine.resume(co) + else + coroutine.resume(co) + end + end) - if errno then - fail(('%s exited with code %d\n%s'):format(errno.cmd, errno.code, errno.stderr)) - return - end + coroutine.yield() + end) - -- refresh buffer - if impure and #impure:totable() > 0 then + if errno then + fail(('%s exited with code %d\n%s'):format(errno.cmd, errno.code, errno.stderr)) + return + end + + -- refresh buffer vim.schedule(function() api.nvim_buf_call(buf, function() local views = save_views(buf) From 39323ba317ceb34362701f1df694c84446fa1665 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 11 Oct 2025 15:01:38 +0000 Subject: [PATCH 2/2] chore(doc): auto generate docs --- doc/guard.nvim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/guard.nvim.txt b/doc/guard.nvim.txt index 15aa0a4..cbbee90 100644 --- a/doc/guard.nvim.txt +++ b/doc/guard.nvim.txt @@ -1,4 +1,4 @@ -*guard.nvim.txt* For NVIM v0.8.0 Last change: 2025 August 24 +*guard.nvim.txt* For NVIM v0.8.0 Last change: 2025 October 11 ============================================================================== Table of Contents *guard.nvim-table-of-contents*