File tree 2 files changed +52
-1
lines changed
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 obj = {};
5
+ //// obj =
6
+ //// {
7
+ //// prop: 3
8
+ //// };
9
+ ////
10
+ //// var obj2 = obj ||
11
+ //// {
12
+ //// prop: 0
13
+ //// }
14
+ ////
15
+
16
+ format . document ( ) ;
17
+ verify . currentFileContentIs (
18
+ `
19
+ var obj = {};
20
+ obj =
21
+ {
22
+ prop: 3
23
+ };
24
+
25
+ var obj2 = obj ||
26
+ {
27
+ prop: 0
28
+ }
29
+ `
30
+ ) ;
31
+
32
+ format . setOption ( "indentMultiLineObjectLiteralBeginningOnBlankLine" , true ) ;
33
+ format . document ( ) ;
34
+ verify . currentFileContentIs (
35
+ `
36
+ var obj = {};
37
+ obj =
38
+ {
39
+ prop: 3
40
+ };
41
+
42
+ var obj2 = obj ||
43
+ {
44
+ prop: 0
45
+ }
46
+ `
47
+ ) ;
You can’t perform that action at this time.
0 commit comments