Update commands.ts

This commit is contained in:
CalWooten95 2021-11-17 16:32:35 -06:00 committed by GitHub
parent 327ce1eea4
commit 7f2181d9ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,17 +156,18 @@ function getIndent(): void {
{ {
let lineNum = editor.selection.active.line + 1; let lineNum = editor.selection.active.line + 1;
let textLine = editor.document.lineAt(lineNum - 1); let textLine = editor.document.lineAt(lineNum - 1);
let i = 0;
if(textLine.isEmptyOrWhitespace) if(textLine.isEmptyOrWhitespace)
{ {
vscode.window.showInformationMessage("Line number " + lineNum.toString() + " Is Empty"); vscode.window.showInformationMessage("Line number " + lineNum.toString() + " Is Empty");
} }
else else
{ {
while(textLine.text[i] === '\t') // Grab tab format from open document
{ let tabFmt = {
i++; 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()); vscode.window.showInformationMessage("Line Number " + lineNum.toString() + " Indentation " + i.toString());
} }
} }