in src/language/expressions/TLE.ts [539:601]
public formatCore(options: ITleFormatOptions, currentIndent: number): string {
// Format a function call expression
if (options.friendly) {
const fullNameLC = this.fullName.toLowerCase();
switch (fullNameLC) {
case 'concat':
// Coalesce adjacent string arguments
return FunctionCallValue.coalesceConcatArguments(this.argumentExpressions, options, currentIndent);
case 'variables':
case 'parameters':
// Use ${name} format for variables/parameters call
if (this.argumentExpressions.length === 1) {
const arg1 = this.argumentExpressions[0];
if (arg1 instanceof StringValue) {
return `\${${arg1.unquotedValue}}`;
}
}
break;
}
}
let multiline = !!options.multiline;
const tabSize = options.multiline?.tabSize ?? 0;
// If there are no arguments or a single simple-valued argument, always put expression on single line
if (this.argumentExpressions.length === 0
|| (this.argumentExpressions.length === 1 &&
(
this.argumentExpressions[0] instanceof StringValue
|| this.argumentExpressions[0] instanceof NumberValue
)
)
) {
multiline = false;
}
// Start with the function name
let result = this.fullName;
// Left paren
if (!!this._leftParenthesisToken) {
result += multiline ? `(\n${' '.repeat(currentIndent + tabSize)}` : '(';
}
// Arguments
for (let i = 0; i < this._argumentExpressions.length; ++i) {
const argExpr = this._argumentExpressions[i];
if (i > 0) {
// tslint:disable-next-line: no-non-null-assertion
result += multiline ? `,\n${' '.repeat(currentIndent + tabSize)}` : ', ';
}
result += argExpr ? argExpr.formatCore(options, currentIndent + tabSize) : ' ';
}
// Right paren
if (!!this._rightParenthesisToken) {
result += `)`;
}
return result;
}