File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -606,6 +606,11 @@ namespace ts.formatting {
606606 if ( ! settings . indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === SyntaxKind . ObjectLiteralExpression ) { // TODO: GH#18217
607607 return rangeIsOnOneLine ( sourceFile , child ! ) ;
608608 }
609+ if ( parent . kind === SyntaxKind . BinaryExpression && sourceFile && child && childKind === SyntaxKind . JsxElement ) {
610+ const parentStartLine = sourceFile . getLineAndCharacterOfPosition ( skipTrivia ( sourceFile . text , parent . pos ) ) . line ;
611+ const childStartLine = sourceFile . getLineAndCharacterOfPosition ( skipTrivia ( sourceFile . text , child . pos ) ) . line ;
612+ return parentStartLine !== childStartLine ;
613+ }
609614 if ( parent . kind !== SyntaxKind . BinaryExpression ) {
610615 return true ;
611616 }
Original file line number Diff line number Diff line change 1+ /// <reference path="fourslash.ts" />
2+
3+ //@Filename : file.tsx
4+ //// function TestWidget() {
5+ //// const test = true;
6+ //// return (
7+ //// <div>
8+ //// {test &&
9+ //// <div>
10+ //// /*1*/ <div>some text</div>/*2*/
11+ //// <div>some text</div>
12+ //// <div>some text</div>
13+ //// </div>
14+ //// }
15+ //// <div>some text</div>
16+ //// </div>
17+ //// );
18+ //// }
19+
20+ format . selection ( "1" , "2" ) ;
21+ verify . currentFileContentIs (
22+ `function TestWidget() {
23+ const test = true;
24+ return (
25+ <div>
26+ {test &&
27+ <div>
28+ <div>some text</div>
29+ <div>some text</div>
30+ <div>some text</div>
31+ </div>
32+ }
33+ <div>some text</div>
34+ </div>
35+ );
36+ }` )
You can’t perform that action at this time.
0 commit comments