reasonml / reasonml/reason

Refmt doesn't break the line when an extra long string occurs in switch branch

Open
#2,727 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
10.3k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

Here's a piece of code to reproduce:

let a = None;
let thing =
  switch (a) {
  | None => "error"
  | Some(fahrenheit) => "Unreasonably long string string string stringgggggggggggggg"
  };

Expected:

let a = None;
let thing =
  switch (a) {
  | None => "error"
  | Some(fahrenheit) => 
    "Unreasonably long string string string stringgggggggggggggg"
  };

Melange playground link

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducible Reason example and the linked Melange playground, then compare the formatter's output with the expected output shown in the issue. Done means the long string in the switch branch begins on its own indented line while the surrounding formatting remains unchanged.

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
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.