Closed TimLariviere closed 2 years ago
While we wait for https://github.com/fsprojects/fantomas/issues/1985 to be released (v4.6 I believe), I've replaced the new F# 6 exp[idx]
with exp.[idx]
.
Fantomas 4.5 formats it to exp [ idx ]
which is interpreted like a function call by F#
Fantomas is not really consistent on extension method either.
Label()
.centerHorizontal() // Here it follows method convention of no space between name and parens
.centerVertical () // Here it follows function convention
I would have expected extension methods to follow the method convention centerHorizontal()
.
Let's merge this PR only after #33, #36, and #37 to avoid conflicts
Btw what about {}
pairs?
I do prefer to have them on separate lines because I use "copy line above"/ "copy line below" a lot and the default styling was messing with that badly. The only solution I could find is to use this formatting:
let obj =
{
FieldA = 1
Field2 = 1
}
or example from code:
member inline _.Combine(a: Content<'msg>, b: Content<'msg>) : Content<'msg> =
{
Widgets = MutStackArray1.combineMut(&a.Widgets, b.Widgets)
}
It it kinda esthetically annoying, but I found it to be a better compromise for my code editing habits.
Thought on this? Do you have a strong opinion?
Personally, I do prefer the recommended style for { }
. Find it more readable, instead of having empty lines with just brackets.
Also following the recommended guideline is better for 2 things:
Personally, I do prefer the recommended style for
{ }
. Find it more readable, instead of having empty lines with just brackets.Also following the recommended guideline is better for 2 things:
- Our samples/templates will be used by users, so we need to follow the guideline
- New contributors (and occasional source code readers) will be less confused if we stick to the guideline
Agreed, oh well. I guess, I will endure the pain :)
Enable consistent formatting for the whole repo to avoid having IDEs auto-formatting differently between each contributors. This is done by using the default configuration of Fantomas (dotnet tool).
See https://docs.microsoft.com/en-us/dotnet/fsharp/style-guide/formatting for more information