@@ -2782,7 +2782,8 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl =
27822782 | Pexp_fun _ | Pexp_newtype _ -> print_arrow e
27832783 | Parsetree. Pexp_constant c ->
27842784 print_constant ~template_literal: (ParsetreeViewer. is_template_literal e) c
2785- | Pexp_jsx_fragment (_ , xs , _ ) -> print_jsx_fragment ~state xs cmt_tbl
2785+ | Pexp_jsx_fragment (o , xs , c ) ->
2786+ print_jsx_fragment ~state o xs c e.pexp_loc cmt_tbl
27862787 | Pexp_construct ({txt = Longident. Lident "()" } , _ ) -> Doc. text " ()"
27872788 | Pexp_construct ({txt = Longident. Lident "[]" } , _ ) ->
27882789 Doc. concat
@@ -4401,9 +4402,20 @@ and print_jsx_expression ~state lident args cmt_tbl =
44014402 ]);
44024403 ])
44034404
4404- and print_jsx_fragment ~state (children : Parsetree.expression list ) cmt_tbl =
4405- let opening = Doc. text " <>" in
4406- let closing = Doc. text " </>" in
4405+ and print_jsx_fragment ~state (opening_greater_than : Lexing.position )
4406+ (children : Parsetree.expression list )
4407+ (closing_lesser_than : Lexing.position ) (fragment_loc : Warnings.loc )
4408+ cmt_tbl =
4409+ let opening =
4410+ let loc : Location.t = {fragment_loc with loc_end = opening_greater_than} in
4411+ print_comments (Doc. text " <>" ) cmt_tbl loc
4412+ in
4413+ let closing =
4414+ let loc : Location.t =
4415+ {fragment_loc with loc_start = closing_lesser_than}
4416+ in
4417+ print_comments (Doc. text " </>" ) cmt_tbl loc
4418+ in
44074419 let line_sep =
44084420 if
44094421 List. length children > 0
@@ -4423,9 +4435,12 @@ and print_jsx_fragment ~state (children : Parsetree.expression list) cmt_tbl =
44234435 [
44244436 Doc. line;
44254437 Doc. join ~sep: line_sep
4426- (List. map
4427- (fun e ->
4428- print_jsx_child ~spread: false ~state e ~cmt_tbl )
4438+ (List. map
4439+ (fun e ->
4440+ let doc =
4441+ print_jsx_child ~spread: false ~state e ~cmt_tbl
4442+ in
4443+ print_comments doc cmt_tbl e.pexp_loc)
44294444 children);
44304445 ]));
44314446 line_sep;
0 commit comments