Trailing commas + mix format

For people that love trailing commas, I released v2.0 of the freedom formatter. It is now a plugin for the builtin formatter (requires Elixir 1.13.2+).

Note that elixir-ls’s next release will support formatting plugins.

Thanks to José Valim for making formatter plugins possible :heart:, and Pete Gamache for the initial version of the freedom_formatter.


What do you think about adding tabular code formatting?

And what do you think about making the formatter bringing all clauses to a single line when possible, eg here when the inspect is removed:

case number do
  1 ->

  2 ->

  3 ->

  number ->

Thanks for your question and interest :slight_smile:

I welcome PRs for new features. At first sight, both of these seem acceptable. Care must be taken into when they would trigger or not and have good test coverage.

I personally do not intend to actually write the implementation for any new option. Trailing commas is what I am interested in. It is in my mind a different beast than the rest because it is not about readability or esthetics, it is about ease of editing and about minimizing diffs. I doubt I will propose to my colleagues to use other formatting options.

If someone else writes them, I will gladly review them and maintain them though.

1 Like

For anyone interested, there’s a thread about trailing commas here:


1 Like