From 7f2181d9eacd88a94d1c175df7287a720c5e6922 Mon Sep 17 00:00:00 2001 From: CalWooten95 Date: Wed, 17 Nov 2021 16:32:35 -0600 Subject: [PATCH] Update commands.ts --- src/commands.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/commands.ts b/src/commands.ts index b97abff..596c082 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -156,17 +156,18 @@ function getIndent(): void { { let lineNum = editor.selection.active.line + 1; let textLine = editor.document.lineAt(lineNum - 1); - let i = 0; if(textLine.isEmptyOrWhitespace) { vscode.window.showInformationMessage("Line number " + lineNum.toString() + " Is Empty"); } else { - while(textLine.text[i] === '\t') - { - i++; - } + // Grab tab format from open document + let tabFmt = { + size: editor.options.tabSize as number, + hard: !editor.options.insertSpaces + }; + let i = pl.Lexer.getIndent(textLine.text, tabFmt); vscode.window.showInformationMessage("Line Number " + lineNum.toString() + " Indentation " + i.toString()); } }