Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Fix another missing comment in JSX case #555

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/res_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3925,8 +3925,8 @@ and printJsxExpression lident args cmtTbl =
formattedProps;
match children with
| Some ({Parsetree.pexp_desc = Pexp_construct ({txt = Longident.Lident "[]"}, None); pexp_loc = loc}) ->
let doc = printComments (Doc.text "/>") cmtTbl loc in
Doc.concat [Doc.line; doc]
let doc = Doc.concat [printCommentsInside cmtTbl loc; Doc.text "/>"] in
Doc.concat [Doc.line; printComments doc cmtTbl loc]
| _ -> Doc.nil
]
);
Expand Down
4 changes: 4 additions & 0 deletions tests/printer/comments/expected/jsx.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ module Cite = {
/>

<A /* comment */ />

<A
// Comment
/>
4 changes: 4 additions & 0 deletions tests/printer/comments/jsx.res
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ module Cite = {
/>

<A /* comment */ />

<A>
// Comment
</A>