mirror of
https://github.com/We-Dont-Byte/Mind_Reader.git
synced 2024-11-15 03:35:59 +00:00
Switch from string concatination to interpolation
Improves concision.
This commit is contained in:
parent
6915cd5b44
commit
3525963bb0
@ -38,7 +38,7 @@ function getLineNumber() {
|
||||
|
||||
if (editor) {
|
||||
let lineNum = fetchLineNumber(editor);
|
||||
vscode.window.showInformationMessage("Line " + lineNum.toString());
|
||||
vscode.window.showInformationMessage(`Line ${lineNum.toString()}`);
|
||||
}
|
||||
else {
|
||||
vscode.window.showErrorMessage('No document currently active');
|
||||
@ -51,7 +51,7 @@ function getIndent() {
|
||||
let lineNum = fetchLineNumber(editor);
|
||||
let textLine = editor.document.lineAt(lineNum - 1);
|
||||
if (textLine.isEmptyOrWhitespace) {
|
||||
vscode.window.showInformationMessage("Line number " + lineNum.toString() + " Is Empty");
|
||||
vscode.window.showInformationMessage(`"Line ${lineNum.toString()} is Empty`);
|
||||
}
|
||||
else {
|
||||
// Grab tab format from open document
|
||||
@ -60,7 +60,7 @@ function getIndent() {
|
||||
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 ${lineNum.toString()}: ${i.toString()} indents`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -78,12 +78,12 @@ function getLeadingSpaces() {
|
||||
let lineNum = fetchLineNumber(editor);
|
||||
let textLine = editor.document.lineAt(lineNum - 1);
|
||||
if(textLine.isEmptyOrWhitespace) {
|
||||
vscode.window.showInformationMessage("Line number " + lineNum.toString() + " Is Empty");
|
||||
vscode.window.showInformationMessage(`Line ${lineNum.toString()} is empty`);
|
||||
}
|
||||
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 ");
|
||||
vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} spaces`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -53,7 +53,7 @@ export default class LineToken {
|
||||
* @return A string representation of the token
|
||||
*/
|
||||
toString(): string {
|
||||
return this.type + ", linenr:" + (this.linenr+1) + ", indentLevel: " + this.indentLevel + ", attr: " + this.attr;
|
||||
return `${this.type}, linenr: ${this.linenr+1}, indentLevel: ${this.indentLevel}, attr: ${this.attr}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user