logo

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

Add Fantomas to the Tools menu in Visual Studio 2019

  1. Clone and build the source code on your local
    git clone git@github.com:fsprojects/fantomas.git fantomas && cd $_
    dotnet tool restore
    dotnet paket restore
    dotnet fake run build.fsx
    
  2. Open the external tools dialog box by choosing Tools > External Tools
  3. Click Add, and then fill in the information
  4. You can also assign shortcut keys to it by choosing Tools > Options, expand Environment, and then choose Keyboard

Appendix

JetBrains Rider

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.