Skip to content

Commit

Permalink
Fix odd spacing on rangeless diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed May 5, 2022
1 parent cfcf11b commit ec4286f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6512,10 +6512,9 @@ function diagnosticToString(diag, forCommand) {
message += `${diag.file}:`;
}
if (diag.range && !isEmptyRange(diag.range)) {
message += `${diag.range.start.line + 1}:${diag.range.start.character + 1} - `;
message += `${diag.range.start.line + 1}:${diag.range.start.character + 1} -`;
}
message += diag.severity;
message += `: `;
message += ` ${diag.severity}: `;
}
message += diag.message;
if (diag.rule) {
Expand Down
6 changes: 3 additions & 3 deletions src/__snapshots__/main.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ Array [
"/path/to/file1.py:1:1 - error: some error",
],
Array [
"/path/to/file2.py:warning: some warning",
"/path/to/file2.py: warning: some warning",
],
Array [
"/path/to/file3.py:1:1 - information: some info (reportSomeInformation)",
Expand Down Expand Up @@ -404,13 +404,13 @@ Array [
"/path/to/file1.py:1:1 - error: some error",
],
Array [
"/path/to/file2.py:warning: some warning",
"/path/to/file2.py: warning: some warning",
],
Array [
"/path/to/file3.py:1:1 - information: some info (reportSomeInformation)",
],
Array [
"/path/to/file3.py:warning: another warning (reportSomeWarning)",
"/path/to/file3.py: warning: another warning (reportSomeWarning)",
],
Array [
"/path/to/file1.py:6:10 - error: some error",
Expand Down
5 changes: 2 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,9 @@ function diagnosticToString(diag: Diagnostic, forCommand: boolean): string {
message += `${diag.file}:`;
}
if (diag.range && !isEmptyRange(diag.range)) {
message += `${diag.range.start.line + 1}:${diag.range.start.character + 1} - `;
message += `${diag.range.start.line + 1}:${diag.range.start.character + 1} -`;
}
message += diag.severity;
message += `: `;
message += ` ${diag.severity}: `;
}

message += diag.message;
Expand Down

0 comments on commit ec4286f

Please sign in to comment.