Skip to content

Fix: Off-by-one Line/Column indexes from Hlint#705

Merged
mfussenegger merged 1 commit intomfussenegger:masterfrom
Arthi-chaud:master
Dec 19, 2024
Merged

Fix: Off-by-one Line/Column indexes from Hlint#705
mfussenegger merged 1 commit intomfussenegger:masterfrom
Arthi-chaud:master

Conversation

@Arthi-chaud
Copy link
Contributor

Hlint returns 1-indexed line and column numbers. However, nvim-lint uses indexes from 0. This causes Hlint's diagnostic to be reported on the wrong line/column

Example Screenshot 2024-12-14 at 12 17 14
Proof that Hlint reports 1-indexed line numbers Here is the output of Hlint:
// hlint --json a.hs | jq
[
  {
    "module": [
      "Main"
    ],
    "decl": [
      "a"
    ],
    "severity": "Warning",
    "hint": "Redundant bracket",
    "file": "a.hs",
    "startLine": 1,
    "startColumn": 5,
    "endLine": 1,
    "endColumn": 8,
    "from": "(1)",
    "to": "1",
    "note": [],
    "refactorings": "[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 8}, subts = [(\"x\",SrcSpan {startLine = 1, startCol = 6, endLine = 1, endCol = 7})], orig = \"x\"}]"
  }
]

This PR fixes this issue and updates the tests accordingly.

Thanks for the plugin :)

@Arthi-chaud Arthi-chaud changed the title Fix: Off-by-one Line/Column indexed from Hlint Fix: Off-by-one Line/Column indexes from Hlint Dec 14, 2024
@mfussenegger mfussenegger merged commit 29e6300 into mfussenegger:master Dec 19, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants