#Is their a `zigfmt` like `rustfmt`?
1 messages · Page 1 of 1 (latest)
zig fmt
fmt Reformat Zig source into canonical form
Nice, also worth asking, if their a equivalent to clippy?
not that I know of
Another tooling question, how do I generate documentation from the doc comments? (something like cargo rustdoc)
ah
i know there used to be a cmd line switch
but i think now it's a target option, ie exe.emit_docs = .emit
I think as a command line swith it's -femit-docs=path/to/docs or just -femit-docs for a default location. It currently needs to happen alongside a build, but you can use -fno-emit-bin to cancel the build part.
speaking about fmt, is there a way to configure it to change some behavior?
nope, by design
yep, that's what I was afraid of 🙂 . I cannot use it then, but understandable.
is there one particular thing on which it's not right for you?
it's purely cosmetic, but I like
const var1 = 12;
const var_longname = 14;```
and fmt is breaking that. (for 2 variables it's ok, but when you have 10 or more it becomes a lot easier to read)
// zig fmt: off
const var1 = 12;
const var_longname = 14;
// zig fmt: on
fantastic ! I didn't know will try that. thanks
zig fmt is nice until it isn't I find. There are times when you want to have multiple while or for that are essentially just unwrapping values but don't want to see them as "nested" - this is when zig fmt becomes a bit annoying for me
There are also other things like value alignment
You can use // zig fmt: off and // zig fmt: on to disable zig fmt around specific parts of the file.