Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix None position values in publishDiagnostics message #753

Merged
merged 1 commit into from Sep 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions server/src/eslintServer.ts
Expand Up @@ -29,6 +29,10 @@ namespace Is {
return value === true || value === false;
}

export function nullOrUndefined(value: any): value is boolean {
return value === null || value === undefined;
}

export function string(value: any): value is string {
return toString.call(value) === '[object String]';
}
Expand Down Expand Up @@ -218,8 +222,8 @@ function makeDiagnostic(problem: ESLintProblem): Diagnostic {
let message = problem.message;
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;
let endLine = Is.nullOrUndefined(problem.endLine) ? startLine : Math.max(0, problem.endLine - 1);
let endChar = Is.nullOrUndefined(problem.endColumn) ? startChar : Math.max(0, problem.endColumn - 1);
return {
message: message,
severity: convertSeverity(problem.severity),
Expand Down Expand Up @@ -1423,4 +1427,4 @@ messageQueue.registerRequest(ExecuteCommandRequest.type, (params) => {
}
});

connection.listen();
connection.listen();