Skip to content

Commit 392d4dd

Browse files
committed
Print single element on same line
1 parent 9a99fc3 commit 392d4dd

File tree

4 files changed

+7
-21
lines changed

4 files changed

+7
-21
lines changed

compiler/syntax/src/res_printer.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4419,7 +4419,7 @@ and print_jsx_fragment ~state (opening_greater_than : Lexing.position)
44194419
in
44204420
let line_sep =
44214421
if
4422-
List.length children > 0
4422+
List.length children > 1
44234423
|| List.exists ParsetreeViewer.is_jsx_expression children
44244424
then Doc.hard_line
44254425
else Doc.line

tests/syntax_tests/data/conversion/reason/expected/string.res.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ carriage return`
88
let x = "\""
99
let y = "\n"
1010

11-
<>
12-
{"\n"->React.string}
13-
</>
11+
<> {"\n"->React.string} </>
1412

1513
// The `//` should not result into an extra comment
1614
let x = `https://www.apple.com`

tests/syntax_tests/data/printer/expr/expected/braced.res.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,5 @@ let x = {
318318
}
319319

320320
// string constant should be printed correct
321-
<>
322-
{"\n"->React.string}
323-
</>
324-
<>
325-
{"\""->React.string}
326-
</>
321+
<> {"\n"->React.string} </>
322+
<> {"\""->React.string} </>

tests/syntax_tests/data/printer/expr/expected/jsx.res.txt

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,7 @@ let x = <MyComponent sidebar={<div> test </div>} nav={<Navbar />} />
315315
module App = {
316316
@react.component
317317
let make = () => {
318-
<>
319-
1
320-
</>
318+
<> 1 </>
321319
}
322320
}
323321

@@ -437,10 +435,7 @@ let x = <C> ...{() => msg->React.string} </C>
437435

438436
let x = <C> ...{array->Array.map(React.string)} </C>
439437

440-
let x =
441-
<>
442-
{array->Array.map(React.string)}
443-
</>
438+
let x = <> {array->Array.map(React.string)} </>
444439

445440
let x = {
446441
let _ = <div />
@@ -453,10 +448,7 @@ let x = {
453448
}
454449

455450
let x = {
456-
let _ =
457-
<>
458-
{children}
459-
</>
451+
let _ = <> {children} </>
460452
msg->React.string
461453
}
462454

0 commit comments

Comments
 (0)