Published 1st of March, 2020, by Nikos Baxevanis. Tagged as f#.

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.



Wish to comment?

You can comment on this post on GitHub. Alternatively, you can discuss this post on Twitter or elsewhere with a permalink. Ping me with the link, and I may respond.