Skip to content

Commit

Permalink
Fix hlint line/column indexes (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthi-chaud authored Dec 19, 2024
1 parent 3683676 commit 29e6300
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lua/lint/linters/hlint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ return {
local items = #output > 0 and vim.json.decode(output) or {}
for _, item in ipairs(items) do
table.insert(diagnostics, {
lnum = item.startLine,
col = item.startColumn,
end_lnum = item.endLine,
end_col = item.endColumn,
lnum = item.startLine - 1,
col = item.startColumn - 1,
end_lnum = item.endLine - 1,
end_col = item.endColumn - 1,
severity = severities[item.severity:lower()],
source = "hlint",
message = item.hint .. (item.to ~= vim.NIL and (": " .. item.to) or ""),
Expand Down
16 changes: 8 additions & 8 deletions spec/hlint_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ describe("linter.hlint", function()
]])
assert.are.same(#result, 1)
local expected = {
lnum = 2,
col = 1,
end_lnum = 2,
end_col = 1,
lnum = 1,
col = 0,
end_lnum = 1,
end_col = 0,
severity = vim.diagnostic.severity.ERROR,
source = "hlint",
message = "Parse error: possibly incorrect indentation or mismatched brackets",
Expand All @@ -34,10 +34,10 @@ describe("linter.hlint", function()
]])
assert.are.same(#result, 1)
local expected = {
lnum = 1,
col = 1,
end_lnum = 1,
end_col = 17,
lnum = 0,
col = 0,
end_lnum = 0,
end_col = 16,
severity = vim.diagnostic.severity.WARN,
source = "hlint",
message = "Use concatMap: concatMap f x",
Expand Down

0 comments on commit 29e6300

Please sign in to comment.