Skip to content

Commit 53f706c

Browse files
Merge pull request #128 from dbarenholz/patch-1
Fix underline position in error message
2 parents c03f6fc + f5b1c97 commit 53f706c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/parsers/ParsingError.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ export class ParsingValidationError extends MetaBindError {
7777
return '';
7878
}
7979

80-
const spacing = ' '.repeat(this.position.from.index + offset);
80+
const spacing = ' '.repeat(this.position.from.column + offset);
8181
// highlight to the end if the end is on the same line. If the end is on a different line, highlight to the end of the line.
82-
const toIndex = this.position.to.line === this.position.from.line ? this.position.to.index : lineLength;
83-
const underline = '^'.repeat(toIndex - this.position.from.index);
82+
const toIndex = this.position.to.line === this.position.from.line ? this.position.to.column : lineLength;
83+
const underline = '^'.repeat(toIndex - this.position.from.column);
8484

8585
return spacing + underline;
8686
}

0 commit comments

Comments
 (0)