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

Fix printing of JSX in binary expressions. #377

Merged
merged 1 commit into from
Apr 10, 2021
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_parsetree_viewer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,13 @@ let shouldInlineRhsBinaryExpr rhs = match rhs.pexp_desc with

let filterPrinteableAttributes attrs =
List.filter (fun attr -> match attr with
| ({Location.txt="bs" | "ns.ternary" | "ns.iflet"}, _) -> false
| ({Location.txt="bs" | "ns.ternary" | "ns.iflet" | "JSX"}, _) -> false
| _ -> true
) attrs

let partitionPrinteableAttributes attrs =
List.partition (fun attr -> match attr with
| ({Location.txt="bs" | "ns.ternary" | "ns.iflet"}, _) -> false
| ({Location.txt="bs" | "ns.ternary" | "ns.iflet" | "JSX"}, _) -> false
| _ -> true
) attrs

Expand Down
12 changes: 12 additions & 0 deletions tests/printer/expr/binary.res
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,15 @@ React.useEffect4(
},
(context.library, context.account, context.chainId, dispatch),
)

@react.component
let make = (~keycap) =>
<Kbd keycap="Ctrl" /> +
<Kbd keycap="Shift" /> +
<Kbd keycap />


<Kbd keycap="Cmd" /> +
<Kbd keycap="Option" /> +
<Kbd keycap="Shift" /> +
<Kbd keycap />
5 changes: 5 additions & 0 deletions tests/printer/expr/expected/binary.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -511,3 +511,8 @@ React.useEffect4(() => {
| _ => None
}
}, (context.library, context.account, context.chainId, dispatch))

@react.component
let make = (~keycap) => <Kbd keycap="Ctrl" /> + <Kbd keycap="Shift" /> + <Kbd keycap />

<Kbd keycap="Cmd" /> + <Kbd keycap="Option" /> + <Kbd keycap="Shift" /> + <Kbd keycap />