added hyphen lines for longer names
This commit is contained in:
@@ -11,15 +11,15 @@ export class FunctionRenderer extends CodeRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private renderFunctionStartComment(functionName: string): string {
|
private renderFunctionStartComment(functionName: string): string {
|
||||||
if (functionName.length >= this.totalFunctionSeparatorChars) {
|
return this.renderComment(this.trailingHyphens) + '\n' +
|
||||||
return this.renderComment(functionName);
|
this.renderFunctionName(functionName) + '\n' +
|
||||||
}
|
this.renderComment(this.trailingHyphens);
|
||||||
return this.renderComment(this.trailingHyphens) + '\n' +
|
|
||||||
this.renderFunctionName(functionName) + '\n' +
|
|
||||||
this.renderComment(this.trailingHyphens);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderFunctionName(functionName: string) {
|
private renderFunctionName(functionName: string) {
|
||||||
|
if (functionName.length >= this.totalFunctionSeparatorChars) {
|
||||||
|
return this.renderComment(functionName);
|
||||||
|
}
|
||||||
const firstHyphens = '-'.repeat(Math.floor((this.totalFunctionSeparatorChars - functionName.length) / 2));
|
const firstHyphens = '-'.repeat(Math.floor((this.totalFunctionSeparatorChars - functionName.length) / 2));
|
||||||
const secondHyphens = '-'.repeat(Math.ceil((this.totalFunctionSeparatorChars - functionName.length) / 2));
|
const secondHyphens = '-'.repeat(Math.ceil((this.totalFunctionSeparatorChars - functionName.length) / 2));
|
||||||
return `${this.renderComment()}${firstHyphens}${functionName}${secondHyphens}`;
|
return `${this.renderComment()}${firstHyphens}${functionName}${secondHyphens}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user