reasonml / reasonml/reason

[refmt] mixing ## and other infix functions

Open
#2,173 2 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

actual:

longEqualityExpression##someRecordField ==
wowThisDoesHaveToBePrettyLong##someRecordField
&&
longEqualityExpression##someRecordField ==
wowThisDoesHaveToBePrettyLong##someRecordField;

Expected (this is what happens currently to record access):

longEqualityExpression.someRecordField
== wowThisDoesHaveToBePrettyLong.someRecordField
&& longEqualityExpression.someRecordField
== wowThisDoesHaveToBePrettyLong.someRecordField;

Compared to my personal preference (prettier is pretty close to this, but does some weird indenting):

longEqualityExpression.someRecordField ==
  wowThisDoesHaveToBePrettyLong.someRecordField &&
longEqualityExpression.someRecordField ==
  wowThisDoesHaveToBePrettyLong.someRecordField;

I think this is related to #2130 in that if we are formatting infix functions without spaces we should basically treat them like record access for all other formatting decisions.

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 by reproducing the actual and expected examples with refmt, then trace the formatter behavior for record access and infix functions. Compare the output for ## mixed with == and && against the requested wrapping and indentation; done means the formatting is consistent with the expected example.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.