Fantomas F# formatter in Visual Studio 2019
You can run Fantomas as an external tool from inside Visual Studio 2019 by using the Tools menu.
This technique should be compatible with
- Visual Studio 2015
- Visual Studio 2017
- Visual Studio 2019 (tested with 16.4.5)
- Clone and build the source code on your local
git clone firstname.lastname@example.org:fsprojects/fantomas.git fantomas && cd $_
dotnet tool restore
dotnet paket restore
dotnet fake run build.fsx
- Open the external tools dialog box by choosing Tools > External Tools
- Click Add, and then fill in the information
- You can also assign shortcut keys to it by choosing Tools > Options, expand Environment, and then choose Keyboard
The fsharp-support uses fantomas under the hood to format the source code. No need for any additional plugins.
Visual Studio Code
The recommended way to use Fantomas is by using the Ionide plugin. Fantomas is integrated in FSAutoComplete which is the language server used by Ionide.
Alternatively, you can install the fantomas-fmt extension.