Skip to content

Commit 5055978

Browse files
fix: auto lint not attached (#226)
* chore(doc): auto generate docs * fix: auto lint not attached --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 5fd971c commit 5055978

File tree

6 files changed

+7
-6
lines changed

6 files changed

+7
-6
lines changed

doc/guard.nvim.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*guard.nvim.txt* For NVIM v0.8.0 Last change: 2025 October 11
1+
*guard.nvim.txt* For NVIM v0.8.0 Last change: 2025 November 07
22

33
==============================================================================
44
Table of Contents *guard.nvim-table-of-contents*

lua/guard/events.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function M.check_lint_should_attach(buf, ft)
115115
:filter(ft == '*' and function(it)
116116
return it.pattern == '*'
117117
end or function(it)
118-
return it.pattern ~= '*'
118+
return it.pattern ~= '*' and it.pattern ~= 'GuardFmt'
119119
end)
120120
:totable() == 0
121121
end

lua/guard/filetype.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ local function box(ft)
101101
if it ~= ft then
102102
if not getmetatable(M[it]) then
103103
M[it] = box(it)
104-
vim.print('init ' .. it)
105104
end
106105
M[it].linter = self.linter
107106
end

lua/guard/format.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ local function do_fmt(buf)
150150
if config.fn then
151151
return config.fn(buf, range, acc)
152152
else
153-
local result = spawn.transform(util.get_cmd(config, fname), cwd, config, acc)
153+
local result = spawn.transform(util.get_cmd(config, fname, buf), cwd, config, acc)
154154
if type(result) == 'table' then
155155
-- indicates error
156156
errno = result
@@ -199,7 +199,7 @@ local function do_fmt(buf)
199199
return
200200
end
201201

202-
vim.system(util.get_cmd(config, fname), {
202+
vim.system(util.get_cmd(config, fname, buf), {
203203
text = true,
204204
cwd = cwd,
205205
env = config.env or {},

lua/guard/lint.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function M.do_lint_single(buf, config)
5959
local data
6060

6161
if lint.cmd then
62-
local out = spawn.transform(util.get_cmd(lint, fname), cwd, lint, prev_lines)
62+
local out = spawn.transform(util.get_cmd(lint, fname, buf), cwd, lint, prev_lines)
6363

6464
-- TODO: unify this error handling logic with formatter
6565
if type(out) == 'table' then

lua/guard/util.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ function M.get_cmd(config, fname, buf)
7777
if type(config.args) == 'function' then
7878
args = config.args(buf)
7979
elseif type(config.args) == 'table' then
80+
---@type FmtConfigTable|LintConfigTable
81+
---@diagnostic disable-next-line: param-type-mismatch
8082
args = vim.deepcopy(config.args)
8183
end
8284

0 commit comments

Comments
 (0)