text.ts -> removed random trailing spaces

Linter was complaining about trailing spaces in random places, removed them to get rid of the errors.
This commit is contained in:
tel0065 2022-03-25 11:13:08 -05:00 committed by GitHub
parent ca3a5163fe
commit 3fed2aa4ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,7 @@ function getLineNumber(): void {
let lineNum: number = fetchLineNumber(editor); let lineNum: number = fetchLineNumber(editor);
vscode.window.showInformationMessage(`Line ${lineNum.toString()}`); vscode.window.showInformationMessage(`Line ${lineNum.toString()}`);
} }
else { else {
vscode.window.showErrorMessage('No document currently active'); vscode.window.showErrorMessage('No document currently active');
} }
@ -64,7 +64,7 @@ function getIndent(): void {
if (textLine.isEmptyOrWhitespace) { if (textLine.isEmptyOrWhitespace) {
vscode.window.showInformationMessage(`Line ${lineNum.toString()} is Empty`); vscode.window.showInformationMessage(`Line ${lineNum.toString()} is Empty`);
} }
else { else {
// Grab tab format from open document // Grab tab format from open document
let tabFmt: any = { let tabFmt: any = {
@ -75,7 +75,7 @@ function getIndent(): void {
vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indents`); vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indents`);
} }
} }
else { else {
vscode.window.showErrorMessage('No document currently active'); vscode.window.showErrorMessage('No document currently active');
} }
@ -87,14 +87,14 @@ function getIndent(): void {
* calculates the number of leading spaces by finding the length of the current line * calculates the number of leading spaces by finding the length of the current line
* then subtracting from that the length of the text after trimming the whitespace at the start * then subtracting from that the length of the text after trimming the whitespace at the start
* which will equal the number of whitespace characters * which will equal the number of whitespace characters
* *
* TO-USE: set calculateLeadingSpaces to true * TO-USE: set calculateLeadingSpaces to true
* *
* method 2 (default): * method 2 (default):
* finds the index position of the first non-whitespace character in a 0-index * finds the index position of the first non-whitespace character in a 0-index
* this number will equal the number of spaces preceding the non-whitespace character * this number will equal the number of spaces preceding the non-whitespace character
* due to the nature of 0-indexes. * due to the nature of 0-indexes.
* *
* TO-USE: set calculateLeadingSpaces to false * TO-USE: set calculateLeadingSpaces to false
*/ */
function getLeadingSpaces(): void { function getLeadingSpaces(): void {
@ -106,12 +106,12 @@ function getLeadingSpaces(): void {
if (textLine.isEmptyOrWhitespace) { if (textLine.isEmptyOrWhitespace) {
vscode.window.showInformationMessage(`Line ${lineNum.toString()} is empty`); vscode.window.showInformationMessage(`Line ${lineNum.toString()} is empty`);
} }
else { else {
/* /*
* set true to use method 1: find the number of leading spaces through arithmetic * set true to use method 1: find the number of leading spaces through arithmetic
* set false to use method 2: find the index position of the first non-whitespace character in a 0-index * set false to use method 2: find the index position of the first non-whitespace character in a 0-index
* *
* default: false * default: false
*/ */
const calculateLeadingSpaces: boolean = false; // change boolean value to change method const calculateLeadingSpaces: boolean = false; // change boolean value to change method
@ -124,7 +124,7 @@ function getLeadingSpaces(): void {
vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} spaces`): vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} spaces`):
vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} space`); vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} space`);
} }
} }
else { else {
vscode.window.showErrorMessage('No document currently active'); vscode.window.showErrorMessage('No document currently active');
} }
@ -152,7 +152,7 @@ function runLineContext(): void {
let contentString: string = createContextString(context, line); let contentString: string = createContextString(context, line);
vscode.window.showInformationMessage(contentString); vscode.window.showInformationMessage(contentString);
} }
else { else {
vscode.window.showErrorMessage('No document currently active'); vscode.window.showErrorMessage('No document currently active');
} }
@ -215,7 +215,7 @@ function runCursorContext(): void {
if (col < leadingWS) { if (col < leadingWS) {
// move effective start to first non-whitespace character in the line // move effective start to first non-whitespace character in the line
col = leadingWS; col = leadingWS;
} }
else if (col > leadingWS + trimmedText.length - 1) { else if (col > leadingWS + trimmedText.length - 1) {
// move effective end to last non-whitespace character in the line // move effective end to last non-whitespace character in the line
col = leadingWS + trimmedText.length - 1; col = leadingWS + trimmedText.length - 1;