fixed plural output logic

Fixed logic of output, was showing singular for '0' ie: '0 space' instead of '0 spaces' - This has been resolved.
This commit is contained in:
tel0065 2022-03-24 04:48:59 -05:00 committed by GitHub
parent 88ddcd7c51
commit 125cf15a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,8 +73,8 @@ function getIndent() {
}; };
let i = pl.Lexer.getIndent(textLine.text, tabFmt); let i = pl.Lexer.getIndent(textLine.text, tabFmt);
// Ternary operator to change the tense of 'indent' to 'indents' for the output if i is greater than 1 /* Ternary operator to change the tense of 'indent' to 'indents' for the output if i is 0 or greater than 1 */
(i > 1) ? (i !== 1) ?
vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indents`): vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indents`):
vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indent`); vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indent`);
} }
@ -120,8 +120,8 @@ function getLeadingSpaces() {
pl.Lexer.getLeadingSpacesByArithmetic(textLine) : pl.Lexer.getLeadingSpacesByArithmetic(textLine) :
pl.Lexer.getLeadingSpacesByIndex(textLine); pl.Lexer.getLeadingSpacesByIndex(textLine);
/* Ternary operator to change the tense of 'space' to 'spaces' for the output if numSpaces is greater than 1 */ /* Ternary operator to change the tense of 'space' to 'spaces' for the output if numSpaces is 0 or greater than 1 */
(numSpaces > 1) ? (numSpaces !== 1) ?
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`);
} }