As part of the F# mentorship program my mentor Anthony Lloyd and I have been working on the Fantomas project.
Fantomas is like prettier or elm-format but for F#.
It was originally created by Anh-Dung Phan and people have suggested that it could be a part of the
F# Compiler Service.
The source code of Fantomas is quite advanced so our approach is to focus first on improving the project in general. We noticed it was a bit old in terms of Visual Studio version and dependencies, so we organized the move to .NET Core.
The port had its challenges but in the end, we were able to release dotnet-fantomas.
Added the following code to your
<ItemGroup> <DotNetCliToolReference Include="dotnet-fantomas" Version="2.7.1" /> </ItemGroup>
dotnet restore and you should be able to run
dotnet fantomas YourFile.fs.
dotnet fantomas --help for more options.
clitool dotnet-fantomas 2.7.1 to your
dotnet-fantomas to your
.paket\paket.exe install and
dotnet fantomas YourFile.fs should work as well.
We need your help
Fantomas still has room for improvement. If we each format one source file and raise an issue on github if things go south, we’d have all the usage coverage we need.
There are still scenarios were the formatting will fail or introduce compile errors. The more concrete examples we have, the easier it is to fix bugs.
Please dear community, give it a spin and write a detailed issue if necessary. Tell us what went wrong, what you’d expected, what framework version you used, why it should format differently, …
If we each format one source file and raise an issue on github if things go south, we’d have all the usage coverage we need.
Ping us on the F# Slack, any feedback is most welcome.
I hope you enjoyed this NuGet package and can use it in your F# workflow.
Photo by Annie Spratt