rescript-lang / rescript-lang/rescript-vscode

Formatter: Line break with long single pipe

Open
#1,070 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
ReScript
Stars
354
Forks
63
Avg merge
11h 29m
Merged PRs (30d)
1

Description

When working with a long module name (typically when using Something__Namespaced), if you use a single pipe it will break line at the argument:

let long =
  SomeLongModuleName.make("Lorem Ipsum es simplemente")->SomeLongModuleName.map(
    updateFooToBar,
  )

This is more difficult to read than if it broke line on the pipe:

let long =
  SomeLongModuleName.make("Lorem Ipsum es simplemente")
  ->SomeLongModuleName.map(updateFooToBar)

I would love it if at the very least I can make the decision myself by introducing a newline, similar with how 2+ pipes will auto break or not

Contributor guide

Open the contributing guide

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

Use the two formatting examples in the issue as the starting cases, and locate the formatter logic that handles a single pipe in a long chained expression. Check how explicit newlines and multiple pipes are currently treated; done means a single pipe can break at the pipe as shown, including when the user introduces a newline.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.