Printing too many parens for lambda:
Open
Nobody has claimed this yet.
KIND: FEATURE REQUEST
Printer
- Dominant language
- OCaml
- Stars
- 10.3k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Description
let make = (~onClick, _children) => {
...component,
reducer: (action, _state) =>
switch action {
| Click =>
ReasonReact.UpdateWithSideEffects(nextState, (self => Js.log("leaf onClick triggered")))
},
didUpdate: self => Js.log("leaf updated (didUpdate)"),
render: self => <div onClick=(e => self.send(Click))> (string("hello")) </div>
};
/* Compare the printed to desired */
ReasonReact.UpdateWithSideEffects(nextState, (self => Js.log("leaf onClick triggered")))
ReasonReact.UpdateWithSideEffects(nextState, self => Js.log("leaf onClick triggered"))
Interestingly, when refmt prints this on its own (not inside of a switch case), it omits the parens.
We should remove these parens to reduce paren-fatigue.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two snippets with refmt, comparing the output inside a switch case with the standalone output. Trace the formatter path responsible for lambda parentheses and confirm the unnecessary parentheses are removed without changing other formatting cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100