Skip to content

Commit 9c5450e

Browse files
committed
fix(suppressFormatter): missing validation that ft has config
1 parent 15799cc commit 9c5450e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lua/rulebook/formatter-actions.lua

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ function M.suppress()
88
local indent = vim.api.nvim_get_current_line():match("^%s*")
99

1010
local ftConfig = require("rulebook.config").config.suppressFormatter[ft]
11+
if not ftConfig then
12+
u.notify(("No formatter suppression configured for %q."):format(ft), "warn")
13+
return
14+
end
1115
local coverage = mode == "n" and "ignoreBlock" or "ignoreRange"
1216
local suppressText = ftConfig[coverage]
13-
14-
-- GUARD
1517
if not suppressText then
16-
u.notify(("No suppress comment %q found for %q."):format(coverage, ft))
18+
u.notify(("No %q configured for %q."):format(coverage, ft), "warn")
1719
return
1820
end
1921

0 commit comments

Comments
 (0)