diff --git a/doc/guard.nvim.txt b/doc/guard.nvim.txt index cbbee90..be7e11d 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 October 11 +*guard.nvim.txt* For NVIM v0.8.0 Last change: 2025 November 07 ============================================================================== Table of Contents *guard.nvim-table-of-contents* diff --git a/lua/guard/events.lua b/lua/guard/events.lua index 405a49e..03773e9 100644 --- a/lua/guard/events.lua +++ b/lua/guard/events.lua @@ -115,7 +115,7 @@ function M.check_lint_should_attach(buf, ft) :filter(ft == '*' and function(it) return it.pattern == '*' end or function(it) - return it.pattern ~= '*' + return it.pattern ~= '*' and it.pattern ~= 'GuardFmt' end) :totable() == 0 end diff --git a/lua/guard/filetype.lua b/lua/guard/filetype.lua index bbb8726..64e4470 100644 --- a/lua/guard/filetype.lua +++ b/lua/guard/filetype.lua @@ -101,7 +101,6 @@ local function box(ft) if it ~= ft then if not getmetatable(M[it]) then M[it] = box(it) - vim.print('init ' .. it) end M[it].linter = self.linter end diff --git a/lua/guard/format.lua b/lua/guard/format.lua index 739bfd2..f8ee2d0 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), cwd, config, acc) + local result = spawn.transform(util.get_cmd(config, fname, buf), cwd, config, acc) if type(result) == 'table' then -- indicates error errno = result @@ -199,7 +199,7 @@ local function do_fmt(buf) return end - vim.system(util.get_cmd(config, fname), { + vim.system(util.get_cmd(config, fname, buf), { text = true, cwd = cwd, env = config.env or {}, diff --git a/lua/guard/lint.lua b/lua/guard/lint.lua index 05a6025..c7d5d55 100644 --- a/lua/guard/lint.lua +++ b/lua/guard/lint.lua @@ -59,7 +59,7 @@ function M.do_lint_single(buf, config) local data if lint.cmd then - local out = spawn.transform(util.get_cmd(lint, fname), cwd, lint, prev_lines) + local out = spawn.transform(util.get_cmd(lint, fname, buf), cwd, lint, prev_lines) -- TODO: unify this error handling logic with formatter if type(out) == 'table' then diff --git a/lua/guard/util.lua b/lua/guard/util.lua index ac195f2..90746e8 100644 --- a/lua/guard/util.lua +++ b/lua/guard/util.lua @@ -77,6 +77,8 @@ function M.get_cmd(config, fname, buf) if type(config.args) == 'function' then args = config.args(buf) elseif type(config.args) == 'table' then + ---@type FmtConfigTable|LintConfigTable + ---@diagnostic disable-next-line: param-type-mismatch args = vim.deepcopy(config.args) end