I use VS2015
to write code in F#
. I usually used R#
to format C#
code and now I try to find something similiar but for F#
.
The main goal is to adjust spaces. For example
MethodName (var1,var2 )|> SomeMethod |> SomeMethod
should be converted to :
MethodName ( var1, var2 ) |> SomeMethod |> SomeMethod
What tool can format my code in such manner?
How to do it?
Update1
I have tried Visual F# Power Tools
and it doesn't work for me.
Thats why i asked here - to receive community opinion about different tools that can format code in F#
I thought this was a duplicate question but could not find it.
The problem with finding the answer by searching such as with Google is that you run into F# Formatting but that is not what you want.
The key is knowing that the project is named fantomas.
How to install Fantomas
It can be installed as a stand alone extension but is more commonly installed as part of the F# Power Tools.
Using Visual Studio
From the VS menu
Tools -> Extensions and Updates...
In the left index click
Online
In the search box in the upper right enter
F# Power Tools
In the list in the middle select
Visual F# Power Tools
Click
Download
Click
Install
Click
Restart Now
Switch to the source code tab
Quick demo of using Fantomas
Note: For this example I had to use different code than provided in the question because this only works with valid F# code and the code in the question was not valid F# code.
Ctrl-K, D (Press Ctrl-K, then Ctrl-D)
Setting options for Fantomas
From Visual Studio menu
Tools -> Options...
In left index scroll down and select
F# Power Tools
Select
Formatting