fix(39047): handle extra spaces after the catch statement (#39306)

This commit is contained in:
Alexander T
2020-06-29 20:10:44 +03:00
committed by GitHub
parent 58ed610ef1
commit ee5c3fa57d
2 changed files with 18 additions and 2 deletions

View File

@@ -348,8 +348,8 @@ namespace ts.formatting {
anyToken,
[isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext],
RuleAction.InsertSpace),
// This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter.
rule("SpaceAfterTryFinally", [SyntaxKind.TryKeyword, SyntaxKind.FinallyKeyword], SyntaxKind.OpenBraceToken, [isNonJsxSameLineTokenContext], RuleAction.InsertSpace),
// This low-pri rule takes care of "try {", "catch {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter.
rule("SpaceAfterTryCatchFinally", [SyntaxKind.TryKeyword, SyntaxKind.CatchKeyword, SyntaxKind.FinallyKeyword], SyntaxKind.OpenBraceToken, [isNonJsxSameLineTokenContext], RuleAction.InsertSpace),
];
return [