From 6915cd5b44305dacdbbbbfcd5575b5851e8f2cdd Mon Sep 17 00:00:00 2001 From: tel0065 <77864718+tel0065@users.noreply.github.com> Date: Wed, 23 Mar 2022 21:42:05 -0500 Subject: [PATCH] leading spaces alternative method Added an alternative method for calculating the leading spaces instead of taking the index of the first non-whitespace character. Leaving it commented out, but still there as an alternative in-case something goes wrong w/ the index method. --- src/commands/text.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/text.ts b/src/commands/text.ts index 99eb15a..03c4132 100755 --- a/src/commands/text.ts +++ b/src/commands/text.ts @@ -82,6 +82,7 @@ function getLeadingSpaces() { } else { let numSpaces = textLine.firstNonWhitespaceCharacterIndex; + // let numSpaces = textLine.text.length - textLine.text.trimStart().length; // Alternative method, same result by calculating the leading spaces vscode.window.showInformationMessage("Line Number " + lineNum.toString() + " Has " + numSpaces.toString()+ " Leading Spaces "); } }