Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/guard.nvim.txt
Original file line number Diff line number Diff line change
@@ -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*
Expand Down
2 changes: 1 addition & 1 deletion lua/guard/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lua/guard/filetype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lua/guard/format.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {},
Expand Down
2 changes: 1 addition & 1 deletion lua/guard/lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lua/guard/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading