fix(60887): Incorrect Formatting on if (a) try {} finally {} (#60898)

This commit is contained in:
Oleksandr T. 2025-02-24 21:51:28 +02:00 committed by GitHub
parent 8ae98d02d8
commit 2c3be449ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View File

@ -729,6 +729,11 @@ export namespace SmartIndenter {
return false;
}
break;
case SyntaxKind.TryStatement:
if (childKind === SyntaxKind.Block) {
return false;
}
break;
}
// No explicit rule for given nodes so the result will follow the default value argument
return indentByDefault;

View File

@ -0,0 +1,15 @@
/// <reference path="fourslash.ts"/>
////if (true) try {
//// // ...
////} finally {
//// // ...
////}
format.document();
verify.currentFileContentIs(
`if (true) try {
// ...
} finally {
// ...
}`);