From f5b1c97384bdb64ed0ed90a53ee639d2d2fadbff Mon Sep 17 00:00:00 2001 From: Daniel Barenholz Date: Wed, 25 Oct 2023 12:29:36 +0200 Subject: [PATCH] Fix underline position in error message --- src/parsers/ParsingError.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/parsers/ParsingError.ts b/src/parsers/ParsingError.ts index a4e06d6a..c52da985 100644 --- a/src/parsers/ParsingError.ts +++ b/src/parsers/ParsingError.ts @@ -77,10 +77,10 @@ export class ParsingValidationError extends MetaBindError { return ''; } - const spacing = ' '.repeat(this.position.from.index + offset); + const spacing = ' '.repeat(this.position.from.column + offset); // 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. - const toIndex = this.position.to.line === this.position.from.line ? this.position.to.index : lineLength; - const underline = '^'.repeat(toIndex - this.position.from.index); + const toIndex = this.position.to.line === this.position.from.line ? this.position.to.column : lineLength; + const underline = '^'.repeat(toIndex - this.position.from.column); return spacing + underline; }