refmt does not preserve original placing of comments
Open
Nobody has claimed this yet.
KIND: BUG
Printer
- Dominant language
- OCaml
- Stars
- 10.3k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Description
In the below snippet NewListener and RemoveListener are both above /* Stream events */.
[@bs.send.pipe : T.t]
external on :
(
[@bs.string]
[
/* EventEmitter events */
[@bs.as "newListener"]
| `NewListener((string, 'any) => unit)
[@bs.as "removeListener"] | `RemoveListener((string, 'any) => unit)
/* Stream events */
/* Readable Stream events */
[@bs.as "close"] | `Close(unit => unit)
[@bs.as "error"] | `Error(Error.t => unit)
[@bs.as "data"] | `Data(Node.string_buffer => unit)
[@bs.as "end"] | `End(unit => unit)
[@bs.as "readable"] | `Readable(unit => unit)
]
) =>
T.t =
"";
It gets formatted as:
[@bs.send.pipe : T.t]
external on :
(
[@bs.string]
[
/* EventEmitter events */
[@bs.as "newListener"]
| `NewListener((string, 'any) => unit)
/* Stream events */
/* Readable Stream events */
[@bs.as "removeListener"] | `RemoveListener((string, 'any) => unit)
[@bs.as "close"] | `Close(unit => unit)
[@bs.as "error"] | `Error(Error.t => unit)
[@bs.as "data"] | `Data(Node.string_buffer => unit)
[@bs.as "end"] | `End(unit => unit)
[@bs.as "readable"] | `Readable(unit => unit)
]
) =>
T.t =
"";
RemoveListener gets pushed below /* Stream events */ and /* Readable Stream events */.
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
Run refmt on the Reason snippet in the issue and compare the output with the original comment positions. Trace the formatter behavior responsible for comments around the variant cases. Done means refmt preserves the placement of both Stream events comments while continuing to format the surrounding code correctly.
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