Skip to content

Commit 6427e5d

Browse files
authored
fix(builtins): prevent erb_lint false header match (#153)
An output:match is performed to detect the header of the linter output to exclude it from being injected into the buffer. However, it matches on ==, which is also a legitimate Ruby operator. When == is encountered in the code, it causes the buffer up to and including that operator to be deleted. Because the linter output uses 16 = symbols in its header, adding an additional == to the match will still work while not causing false matches with legitimate uses of ==.
1 parent e047015 commit 6427e5d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/null-ls/builtins/formatting/erb_lint.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ return h.make_builtin({
2020
output = "raw",
2121
on_output = function(params, done)
2222
local output = params.output
23-
local metadata_end = output:match(".*==()") + 1
23+
local metadata_end = output:match(".*====()") + 1
2424
return done({ { text = output:sub(metadata_end) } })
2525
end,
2626
},

0 commit comments

Comments
 (0)