File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -4312,17 +4312,26 @@ and print_pexp_apply ~state expr cmt_tbl =
43124312and 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 props_doc =
4316+ match props with
4317+ | [] -> Doc. nil
4318+ | _ ->
4319+ Doc. indent
4320+ (Doc. concat
4321+ [Doc. line; Doc. group (Doc. join formatted_props ~sep: Doc. line)])
4322+ in
4323+ let closing_tag =
4324+ if Doc. will_break props_doc then Doc. concat [Doc. soft_line; Doc. text " />" ]
4325+ else Doc. concat [Doc. space; Doc. text " />" ]
4326+ in
43154327 Doc. group
43164328 (Doc. concat
43174329 [
43184330 print_comments
43194331 (Doc. concat [Doc. less_than; name])
43204332 cmt_tbl tag_name.Asttypes. loc;
4321- Doc. indent
4322- (Doc. concat
4323- [Doc. line; Doc. group (Doc. join formatted_props ~sep: Doc. line)]);
4324- Doc. soft_line;
4325- Doc. text " />" ;
4333+ props_doc;
4334+ closing_tag;
43264335 ])
43274336
43284337and print_jsx_container_tag ~state tag_name props
You can’t perform that action at this time.
0 commit comments