r/fsharp•
debugnik

Disabling Fantomas on some files?

I had to disable format-on-save for F# because Fantomas is doing destructive changes to certain files, but I sometimes still trigger the formatter out of muscle memory and I worry that collaborators with format-on-save could have trouble too, so I'd like to prevent the formatter from actually doing anything on those files when triggered, or even solution-wide.

I tried excluding them in .fantomasignore, but Ionide (or rather FSAC) seems to be ignoring that file and the request to disable Fantomas from .editorconfig has been declined. Have I missed anything? Or should I just make my case for reconsidering the .editorconfig setting in Fantomas (or respecting .fantomasignore in FSAC)?

Posted May 2, 2021, 2:22 PM UTC

93
chusk3•

We're using the standard fantomas APIs for discovering the configs and running formatting, so I'd try to isolate with a reproducible test case and submit an issue to FSAC or fantomas for sure if the .fantomasignore isn't read by those.

2
debugnikOP•

Apparently support for .fantomasignore is not simply part of the Fantomas API; filtering must be done manually using a predicate from Fantomas.Extras (which FSAC already depends on for .editorconfig). I could submit a pull request to FSAC if supporting it is something you want, looks like a small addition. Should I first open an issue anyway?

2
chusk3•

Please! And thank you for considering contributing :)

2