Coming from rust and i’m used to being able to make a .rustfmt.toml
file in the project root to customize how i want things done
I’ve looked around for info on zig fmt and if i can configure anything but i wasn’t able to find anything so i just wanted to ask and make sure im not just terrible at googling
1 Like
Your googling skills haven’t failed you
It’s not possible to configure zig fmt
. See FAQ · ziglang/zig Wiki · Why does zig fmt
have no configuration options? for the official rationale.
You can control line wrapping by using trailing commas ,
in lists like struct initializers or function calls, and you can also disable the formatter for sections of code in a file with // zig fmt: off
directives, but that’s the extent of it.
No configuration options means that people expend less energy on bickering about style trivialities and more energy on the things that actually matter, like actually developing software. Having every project (that uses zig fmt
) share one consistent style and thus having almost every snippet of Zig code take on the same familiar visual shape also greatly reduces cognitive load for readers/reviewers/learners.
13 Likes
butbutbut my max_line_width=99999999 (anyway thanks for the answer, that actually does make a lot of sense)
2 Likes
You can also make judicious use of comments to break up lines