PublishedTags

Fantomas configuration file

Hi all,

The cat’s out of the bag:

Fantomas now has support for configuration files. This means you can override the default settings using a JSON file. Check out the documentation for more information.

Fantomas configuration via console

In this post I wish to answer a couple of small questions about the Fantomas configuration files.

JSON schema?

We’ve added a JSON schema definition to http://schemastore.org. So to get intellisense in most editors, you can add $schema to the configuration file.

{
    "$schema": "http://json.schemastore.org/fantomas",
    "KeepNewlineAfter": false,
    "IndentOnTryWith": true
}

Ionide integration?

When using the latest Ionide version (4.4.3 and higher), your configuration will be picked up due to the integration of Fantomas via FSAutocomplete.

If something doesn’t work out, you can enable verbose logging in VSCode.

{
    "FSharp.verboseLogging": true
}

Then you can see warnings or errors in the output window. A fallback to the default configuration will happen when the parsing failed.

For example:

Warning in Ionide

Room for improvement

At the time of writing, the configuration file is not cached in FSAutocomplete. It could be kept in memory and updated when a configuration file changes. Feel free to submit a pull request to FSAutocomplete.

Why a beta version?

The main reason this is not an official release just yet is due to the fact that we want to be sure this works out for everyone. So please provide us feedback if you encounter any problems whatsoever.

Rider support?

If the solution we have in mind appears to be working out nicely for Ionide users, I will submit a pull request to JetBrains/fsharp-support. It might involved some more thinking to find the best approach, however I’m confident in collaboration with the team we can find a way.

Please keep in mind that Fantomas updates to Rider are linked to their release cadence.

Road to adoption?

This year my personal aspiration to increase the adoption of Fantomas. Both in terms of users and people who submit pull requests.

I have some plans and ideas for this. Unfortunately, I’m unable to share anything just yet. Stay tuned for more!

Please o please report any issues you encounter using our online tool. Or post any suggestions on GitHub.

Fantomas can only improve when feedback is presented

Take care everyone!

Cheers,

nojaf

Photo by unsplash-logoIvars Krutainis