File tree Expand file tree Collapse file tree 2 files changed +52
-1
lines changed Expand file tree Collapse file tree 2 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -539,10 +539,14 @@ namespace ts.formatting {
539
539
return true ;
540
540
case SyntaxKind . VariableDeclaration :
541
541
case SyntaxKind . PropertyAssignment :
542
+ case SyntaxKind . BinaryExpression :
542
543
if ( ! settings . indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === SyntaxKind . ObjectLiteralExpression ) { // TODO: GH#18217
543
544
return rangeIsOnOneLine ( sourceFile , child ! ) ;
544
545
}
545
- return true ;
546
+ if ( parent . kind !== SyntaxKind . BinaryExpression ) {
547
+ return true ;
548
+ }
549
+ break ;
546
550
case SyntaxKind . DoStatement :
547
551
case SyntaxKind . WhileStatement :
548
552
case SyntaxKind . ForInStatement :
Original file line number Diff line number Diff line change
1
+ /// <reference path='fourslash.ts' />
2
+
3
+ ////
4
+ //// var clear = {};
5
+ //// clear =
6
+ //// {
7
+ //// outerKey:
8
+ //// {
9
+ //// innerKey: 1,
10
+ //// innerKey2:
11
+ //// 2
12
+ //// }
13
+ //// };
14
+ ////
15
+
16
+ format . document ( ) ;
17
+ verify . currentFileContentIs (
18
+ `
19
+ var clear = {};
20
+ clear =
21
+ {
22
+ outerKey:
23
+ {
24
+ innerKey: 1,
25
+ innerKey2:
26
+ 2
27
+ }
28
+ };
29
+ `
30
+ ) ;
31
+
32
+ format . setOption ( "indentMultiLineObjectLiteralBeginningOnBlankLine" , true ) ;
33
+ format . document ( ) ;
34
+ verify . currentFileContentIs (
35
+ `
36
+ var clear = {};
37
+ clear =
38
+ {
39
+ outerKey:
40
+ {
41
+ innerKey: 1,
42
+ innerKey2:
43
+ 2
44
+ }
45
+ };
46
+ `
47
+ ) ;
You can’t perform that action at this time.
0 commit comments