Skip to content

Commit

Permalink
Merge pull request #153 from mysticatea/zero-location-support
Browse files Browse the repository at this point in the history
Fixes zero location support
  • Loading branch information
dbaeumer committed Oct 14, 2016
2 parents 16ec52e + a552bf1 commit 3b373eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions eslint-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ function makeDiagnostic(problem: ESLintProblem): Diagnostic {
let message = (problem.ruleId != null)
? `${problem.message} (${problem.ruleId})`
: `${problem.message}`;
let startLine = problem.line - 1;
let startChar = problem.column - 1;
let endLine = problem.endLine ? problem.endLine - 1 : startLine;
let endChar = problem.endColumn ? problem.endColumn - 1 : startChar;
let startLine = Math.max(0, problem.line - 1);
let startChar = Math.max(0, problem.column - 1);
let endLine = problem.endLine != null ? Math.max(0, problem.endLine - 1) : startLine;
let endChar = problem.endColumn != null ? Math.max(0, problem.endColumn - 1) : startChar;
return {
message: message,
severity: convertSeverity(problem.severity),
Expand Down

0 comments on commit 3b373eb

Please sign in to comment.