zig version 0.4.0+fcc0728
The following is a fragment of code I have written that is currently formatted using zig fmt:
pubconstIfSt=struct {
condition: Expression,
then_body: Block,
elseif_clauses: []constElseifClause,
// TODO: else clause causes a compiler crash// else_clause: ?ElseClause,pubconstParser=comb.fluent//
.req("_", Leaf("KeyIf")) //
.req("condition", Expression).cut("Expected a boolean expression after `if`") //
.req("then_body", Block).cut("Expected a then-body after an if-condition") //
.star("elseif_clauses", ElseifClause) //// .opt("else_clause", ElseClause) //
.seq(@This());
location: Location,
};Notice the drop in indentation starting with the final comment line, which also affects the following line. If the comment is removed, the next line is indented correctly.
While this style is probably unconventional for Zig, I find it a simple way to organize this kind of API, with one command per line, and without the noise of repeated struct literals. In any case, it's unfortunate that the indentation of subsequent lines of code is affected by the insertion of comments.
zig version 0.4.0+fcc0728
The following is a fragment of code I have written that is currently formatted using
zig fmt:Notice the drop in indentation starting with the final comment line, which also affects the following line. If the comment is removed, the next line is indented correctly.
While this style is probably unconventional for Zig, I find it a simple way to organize this kind of API, with one command per line, and without the noise of repeated struct literals. In any case, it's unfortunate that the indentation of subsequent lines of code is affected by the insertion of comments.