Skip to content

Commit 6faff5e

Browse files
committed
fix formatting for field selection
1 parent 16ad1fd commit 6faff5e

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/format.zig

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,13 @@ fn formatNode(tree: parse.Tree, current: usize, writer: anytype) !void {
308308
},
309309

310310
// emit without spaces between childern
311-
.layout_qualifier, .prefix, .postfix, .array, .array_specifier => {
311+
.layout_qualifier,
312+
.prefix,
313+
.postfix,
314+
.array,
315+
.array_specifier,
316+
.selection,
317+
=> {
312318
const children = tree.children(current);
313319
for (children.start..children.end) |child| {
314320
try formatNode(tree, child, writer);
@@ -558,6 +564,15 @@ test "format qualifiers" {
558564
);
559565
}
560566

567+
test "format field selection" {
568+
try expectIsFormatted(
569+
\\void main() {
570+
\\ int gid = gl_GlobalInvocationId.x;
571+
\\}
572+
\\
573+
);
574+
}
575+
561576
fn expectIsFormatted(source: []const u8) !void {
562577
try expectFormat(source, source);
563578
}

0 commit comments

Comments
 (0)