proposal: change `zig fmt` to format lists of one item with spaces
before:
.{x}
.{ x, y }
after:
.{ x }
.{ x, y }
love zig fmt and all it fights for. this feels like its one inconsistency though
I like this. More consistency with tuple type declarations of one item adding a space and multi-item lists. Also makes it easier for me to read what's inside the list.
somewhat related: https://github.com/ziglang/zig/issues/20349 (just wanted to link it so one isn't overlooked)
I don't think it is necessary for a formater to be maximally consistent.
Consistency is not a terminal goal. Usually consistency is desired, because it helps the human to avoid decisions. If you can do X or Y, then you need to spend extra mental effort to choose which one of the two to use in any particular instance. In such cases, "always use X because consistency" is a useful mental effort saving heuristic, whose benefits usually outweigh relative merits of X or Y in any particular case.
But here, we are talking about a tool, and the tool is perfectly fine with using complex rules of decisions. So, in this case, there's no benefit to consistency as a coordination point.
Disregarding consistency, for me personally single-item list reads better as
.{x}