We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ca442a commit a7a48e5Copy full SHA for a7a48e5
compiler/syntax/src/res_printer.ml
@@ -4448,10 +4448,15 @@ and print_jsx_children ~state (children_expr : Parsetree.expression) ~sep
4448
| Braced braces_loc ->
4449
print_comments (add_parens_or_braces expr_doc) cmt_tbl braces_loc
4450
in
4451
+ let get_first_leading_comment loc =
4452
+ match get_first_leading_comment cmt_tbl loc with
4453
+ | None -> loc
4454
+ | Some comment -> Comment.loc comment
4455
+ in
4456
let get_loc expr =
4457
match ParsetreeViewer.process_braces_attr expr with
- | None, _ -> expr.pexp_loc
- | Some ({loc}, _), _ -> loc
4458
+ | None, _ -> get_first_leading_comment expr.pexp_loc
4459
+ | Some ({loc}, _), _ -> get_first_leading_comment loc
4460
4461
let rec loop prev acc exprs =
4462
match exprs with
0 commit comments