Closed rliebz closed 11 months ago
According to the LSP spec, the line and character must both be unsigned integers. The spec also specifically calls out that -1 is not supported: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position
-1
With some code structures, it is possible to produce an error such as the following from golangci-lint run --out-format=json:
golangci-lint run --out-format=json
{ "FromLinter": "typecheck", "Text": ": # github.com/my/package [github.com/my/package.test]\n./main.go:31:2: undefined: asdf", "Severity": "", "SourceLines": [ "package main" ], "Replacement": null, "Pos": { "Filename": "main.go", "Offset": 0, "Line": 1, "Column": 0 }, "ExpectNoLint": false, "ExpectedNoLintLinter": "" }
This ultimately does result in some issues with tooling compatibility, for example: https://github.com/folke/trouble.nvim/issues/224#issuecomment-1495410321
By preventing the number from dropping below zero, this class of error should no longer be present.
@nametake let me know if there's anything I can do to help get this merged
Thank you!
According to the LSP spec, the line and character must both be unsigned integers. The spec also specifically calls out that
-1
is not supported: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#positionWith some code structures, it is possible to produce an error such as the following from
golangci-lint run --out-format=json
:This ultimately does result in some issues with tooling compatibility, for example: https://github.com/folke/trouble.nvim/issues/224#issuecomment-1495410321
By preventing the number from dropping below zero, this class of error should no longer be present.