Skip to content

Commit fc6f950

Browse files
committed
Indent jsx
1 parent 239f653 commit fc6f950

File tree

3 files changed

+36
-31
lines changed

3 files changed

+36
-31
lines changed

compiler/syntax/src/res_printer.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,7 @@ and print_value_binding ~state ~rec_flag (vb : Parsetree.value_binding) cmt_tbl
20982098
| {pexp_desc = Pexp_newtype _} -> false
20992099
| {pexp_attributes = [({Location.txt = "res.taggedTemplate"}, _)]} ->
21002100
false
2101+
| {pexp_desc = Pexp_jsx_fragment _} -> true
21012102
| e ->
21022103
ParsetreeViewer.has_attributes e.pexp_attributes
21032104
|| ParsetreeViewer.is_array_access e)

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ module Cite = {
6565
React.string("Hello, World!")}
6666
</div>
6767

68-
let x = <>
69-
{a}
70-
{b}
71-
</>
68+
let x =
69+
<>
70+
{a}
71+
{b}
72+
</>

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

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -99,27 +99,28 @@ let nav3 =
9999
</NavContent>
100100
</Nav>
101101

102-
let avatarSection = <>
103-
<div style={{"zIndex": "1", "opacity": opacityUser}}>
104-
<Avatar user={user} size={45} />
105-
</div>
106-
{user.email !== viewer.email
107-
? <div
108-
style={{
109-
"marginLeft": marginLeft + "em",
110-
"opacity": opacityAdmin,
111-
"zIndex": "0",
112-
"cursor": "pointer",
113-
}}
114-
onMouseEnter={_ => setHoveringAdmin(true)}
115-
onMouseLeave={_ => setHoveringAdmin(false)}
116-
onClick={_e => {
117-
stopImpersonating(csrfToken)
118-
}}>
119-
<Avatar user={viewer} size={45} />
120-
</div>
121-
: React.nullElement}
122-
</>
102+
let avatarSection =
103+
<>
104+
<div style={{"zIndex": "1", "opacity": opacityUser}}>
105+
<Avatar user={user} size={45} />
106+
</div>
107+
{user.email !== viewer.email
108+
? <div
109+
style={{
110+
"marginLeft": marginLeft + "em",
111+
"opacity": opacityAdmin,
112+
"zIndex": "0",
113+
"cursor": "pointer",
114+
}}
115+
onMouseEnter={_ => setHoveringAdmin(true)}
116+
onMouseLeave={_ => setHoveringAdmin(false)}
117+
onClick={_e => {
118+
stopImpersonating(csrfToken)
119+
}}>
120+
<Avatar user={viewer} size={45} />
121+
</div>
122+
: React.nullElement}
123+
</>
123124

124125
let x = <> </>
125126

@@ -436,9 +437,10 @@ let x = <C> ...{() => msg->React.string} </C>
436437

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

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

443445
let x = {
444446
let _ = <div />
@@ -451,9 +453,10 @@ let x = {
451453
}
452454

453455
let x = {
454-
let _ = <>
455-
{children}
456-
</>
456+
let _ =
457+
<>
458+
{children}
459+
</>
457460
msg->React.string
458461
}
459462

0 commit comments

Comments
 (0)