diff --git a/lua/lint/linters/hlint.lua b/lua/lint/linters/hlint.lua index 5ea61f65..829ccd7a 100644 --- a/lua/lint/linters/hlint.lua +++ b/lua/lint/linters/hlint.lua @@ -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 ""), diff --git a/spec/hlint_spec.lua b/spec/hlint_spec.lua index e76e7535..7495586f 100644 --- a/spec/hlint_spec.lua +++ b/spec/hlint_spec.lua @@ -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", @@ -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",