From d0522c1ea162db84ff02010c419d1c5a1fcc108e Mon Sep 17 00:00:00 2001 From: Abdelrahman Aly Abounegm Date: Mon, 14 Oct 2024 11:19:55 +0300 Subject: [PATCH] Fix indentation token lengths (#1708) When the dedent had some whitespace after it (not an empty line), that whitespace was considered part of the dedent token, causing the CST node range to be off --- .../langium/src/parser/indentation-aware.ts | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/packages/langium/src/parser/indentation-aware.ts b/packages/langium/src/parser/indentation-aware.ts index 3891f585e..1d7636c1c 100644 --- a/packages/langium/src/parser/indentation-aware.ts +++ b/packages/langium/src/parser/indentation-aware.ts @@ -272,16 +272,7 @@ export class IndentationAwareTokenBuilder 1) { remainingDedents.push( - this.createIndentationTokenInstance(this.dedentTokenType, text, this.options.dedentTokenName, text.length) + this.createIndentationTokenInstance(this.dedentTokenType, text, '', text.length) ); this.indentationStack.pop(); }