format: indent ')' which is on separate line

This commit is contained in:
全卓 2022-12-19 17:37:32 +08:00
parent d2f9863373
commit 3f47c16aaa
1 changed files with 6 additions and 1 deletions

View File

@ -204,10 +204,15 @@ export class Formatter extends CMakeListener {
}
// ')'
const rParenToken = ctx.RParen().symbol;
const rParenIndex = rParenToken.tokenIndex;
const prevToken = this._tokenStream.get(rParenIndex - 1);
if (rParenToken.line !== prevToken.line) {
this._formatted += ' '.repeat(this.getIndent());
}
this._formatted += ')';
// get comment on right of command
const rParenIndex: number = ctx.RParen().symbol.tokenIndex;
this._formatted += this.getHiddenTextOnRight(rParenIndex, this.getIndent());
// command terminator