format icon indicating copy to clipboard operation
format copied to clipboard

F# support or fantomas tool

Open jkone27 opened this issue 3 years ago • 5 comments

is there a way to also invoke Fantomas from dotnet format, making it the default for F# ?

https://github.com/fsprojects/fantomas/issues?q=is%3Aissue+is%3Aopen+dotnet+format

could be a nice integration useful to add support for fsharp as well (other than just C# and VB) and already supports .editorconfig

dotnet format

could also invoke fantomas in any .fsproj directory maybe ? just an idea

jkone27 avatar Feb 23 '22 09:02 jkone27

cc: @jmarolf

JoeRobich avatar Feb 23 '22 18:02 JoeRobich

Long term, yes. Talked to the fantomas maintainers a while back and they where amenable to use including/calling into fantomas for F# projects. Would be willing to accept a community contribution if I am not getting around to it fast enough :) My understanding is that fantomas has disjoint formatting rules from C# and VB so it should be a simple drop-in

jmarolf avatar Feb 23 '22 22:02 jmarolf

Long term, yes. Talked to the fantomas maintainers a while back and they where amenable to use including/calling into fantomas for F# projects. Would be willing to accept a community contribution if I am not getting around to it fast enough :) My understanding is that fantomas has disjoint formatting rules from C# and VB so it should be a simple drop-in

Hello @jmarolf, what are plans now?

rstm-sf avatar Feb 15 '24 17:02 rstm-sf

@rstm-sf At the moment there are no plans for F# support.

My thoughts on a possible implementation:

I do not think we would ship fantomas directly. When we encountered a F# project we would perform a check to see if the fantomas tool is installed. If not, we would log a message giving instructions on installing the fantomas tool. If so, we would shell out to fantomas for the F# projects in the workspace. As fantomas is a whitespace formatter, it would only run when whitespace formatting was being performed.

JoeRobich avatar Feb 15 '24 21:02 JoeRobich