mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 03:09:39 -06:00
fix(60887): Incorrect Formatting on if (a) try {} finally {} (#60898)
This commit is contained in:
parent
8ae98d02d8
commit
2c3be449ff
@ -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;
|
||||
|
||||
15
tests/cases/fourslash/formatTryFinally.ts
Normal file
15
tests/cases/fourslash/formatTryFinally.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////if (true) try {
|
||||
//// // ...
|
||||
////} finally {
|
||||
//// // ...
|
||||
////}
|
||||
|
||||
format.document();
|
||||
verify.currentFileContentIs(
|
||||
`if (true) try {
|
||||
// ...
|
||||
} finally {
|
||||
// ...
|
||||
}`);
|
||||
Loading…
x
Reference in New Issue
Block a user