-
Notifications
You must be signed in to change notification settings - Fork 471
Open
Labels
Description
background: https://forum.rescript-lang.org/t/my-main-gripes-with-rescript-constructive-criticism/6981/5
right now, the formatter is ruthless in formatting. this is usually appreciated, but for externs, it becomes messy sometimes.
imagine a file such as
@module("moduleX") extern f1: someType1 => someType2 = "someFunc"
@module("moduleX") extern f2: anotherType1 => thirdType = "someOtherFunc"
@module("moduleX") extern f3: interestingType1 => interestingType2 = "someFuncWithALongerName"
@module("moduleX") extern f4: t1 => t2 = "anotherFunc"
the formatter often aggressively reformats it like:
@module("moduleX") extern f1: someType1 => someType2 =
"someFunc"
@module("moduleX")
extern f2: anotherType1 => thirdType = "someOtherFunc"
@module("moduleX")
extern f3: interestingType1 => interestingType2 =
"someFuncWithALongerName"
@module("moduleX") extern f4: t1 => t2 = "anotherFunc"
because of the different lengths. this makes the externs really difficult to parse easily by looking at them because there are often repetitions and variants in the functions, so keeping them all on the same format is easier despite some lines being a little longer than what the formatter prefers.
let's discuss potential solutions for this.