Skip to content

Commit aaef8ac

Browse files
committed
Fix closing tag indentation
1 parent 0133f91 commit aaef8ac

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

compiler/syntax/src/res_comments_table.ml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,24 +1473,21 @@ and walk_expression expr t comments =
14731473
let xs = exprs |> List.map (fun e -> Expression e) in
14741474
walk_list xs t rest
14751475
| Pexp_jsx_unary_element {jsx_unary_element_props = props} ->
1476-
let _ =
1477-
List.map
1478-
(fun prop ->
1479-
match prop with
1480-
| Parsetree.JSXPropPunning (_, _) -> ()
1481-
| Parsetree.JSXPropValue (_, _, expr) ->
1482-
let _leading, inside, trailing =
1483-
partition_by_loc comments expr.pexp_loc
1484-
in
1485-
let after_expr, _ =
1486-
partition_adjacent_trailing expr.pexp_loc trailing
1487-
in
1488-
attach t.trailing expr.pexp_loc after_expr;
1489-
walk_expression expr t inside
1490-
| Parsetree.JSXPropSpreading (_loc, _expr) -> ())
1491-
props
1492-
in
1493-
()
1476+
List.iter
1477+
(fun prop ->
1478+
match prop with
1479+
| Parsetree.JSXPropPunning (_, _) -> ()
1480+
| Parsetree.JSXPropValue (_, _, expr) ->
1481+
let _leading, inside, trailing =
1482+
partition_by_loc comments expr.pexp_loc
1483+
in
1484+
let after_expr, _ =
1485+
partition_adjacent_trailing expr.pexp_loc trailing
1486+
in
1487+
attach t.trailing expr.pexp_loc after_expr;
1488+
walk_expression expr t inside
1489+
| Parsetree.JSXPropSpreading (_loc, _expr) -> ())
1490+
props
14941491
| Pexp_jsx_container_element
14951492
{
14961493
jsx_container_element_opening_tag_end = opening_greater_than;

compiler/syntax/src/res_printer.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4312,7 +4312,6 @@ and print_pexp_apply ~state expr cmt_tbl =
43124312
and print_jsx_unary_tag ~state tag_name props cmt_tbl =
43134313
let name = print_jsx_name tag_name in
43144314
let formatted_props = print_jsx_props ~state props cmt_tbl in
4315-
let formatted_props = formatted_props @ [Doc.text "/>"] in
43164315
Doc.group
43174316
(Doc.concat
43184317
[
@@ -4322,6 +4321,8 @@ and print_jsx_unary_tag ~state tag_name props cmt_tbl =
43224321
Doc.indent
43234322
(Doc.concat
43244323
[Doc.line; Doc.group (Doc.join formatted_props ~sep:Doc.line)]);
4324+
Doc.soft_line;
4325+
Doc.text "/>";
43254326
])
43264327

43274328
and print_jsx_container_tag ~state tag_name props

0 commit comments

Comments
 (0)