I’m using Elixir 1.6.0. The default mix format
formats the following (A) into (B).
Is there any to allow syntax A?(I want to preserve “,” at the last item in the list)
syntax A
[
1,
2,
]
syntax B
[
1,
2
]
I’m using Elixir 1.6.0. The default mix format
formats the following (A) into (B).
Is there any to allow syntax A?(I want to preserve “,” at the last item in the list)
syntax A
[
1,
2,
]
syntax B
[
1,
2
]
Yes, not to use the formatter.
The formatter is very opinionated and except for paren-calls and line length not configurable.
The feature has been discussed a few times on the forum, the issue tracker, and the core mailinglist.
As far as I remember, it is because trailing commas would add ambiguity for the parser in some situations they are discouraged by the formatter in all places to maintain uniformity.
Only in cases of parenthesis-less functions, which I’m fine with them not being allowed there, they should be allowed and formatted in by default on multi-lines in all other cases.
Thank you for your reply. I’ll bear it.