How to make ionide-fsharp formater work in VSCode

857 Views Asked by At

I have a problem with ionide-fsharp formatter. When I install the extension in VSCode I am not able to automaticaly format a file on save. I have fantomas installed globaly and I tried to go through FSAC, but nothing has helped. I think that I need to put something in VSCode's settings.json like I have a prettier config for typescript.

"[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
2

There are 2 best solutions below

1
On BEST ANSWER

So this is how my own config looks like

"[fsharp]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "Ionide.Ionide-fsharp"
},
3
On

You should ensure that editor.formatOnSave is set to true (either for just the fsharp language or globally) and then FSAC should pick up your globally-installed Fantomas.