Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1516 from eclipse/jk_gh1515
Browse files Browse the repository at this point in the history
[lsp] avoid negative positions
  • Loading branch information
JanKoehnlein committed Jun 4, 2020
2 parents c9c7400 + 4f3812f commit cd63d80
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ protected Diagnostic toDiagnostic(Issue issue) {
result.setSeverity(toDiagnosticSeverity(issue.getSeverity()));

// line and column numbers in LSP are 0-based
Position start = new Position(issue.getLineNumber() - 1, issue.getColumn() - 1);
Position end = new Position(issue.getLineNumberEnd() - 1, issue.getColumnEnd() - 1);
Position start = new Position(Math.max(0, issue.getLineNumber() - 1), Math.max(0, issue.getColumn() - 1));
Position end = new Position(Math.max(0, issue.getLineNumberEnd() - 1), Math.max(0, issue.getColumnEnd() - 1));
result.setRange(new Range(start, end));
return result;
}
Expand Down

0 comments on commit cd63d80

Please sign in to comment.