From cea053a2b9e097449ecb5dead5ee0aa36d4be2db Mon Sep 17 00:00:00 2001 From: Altagos Date: Tue, 23 Jun 2026 10:59:50 +0200 Subject: [PATCH] update to latest zig master --- build.zig | 3 +-- pretty.zig | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/build.zig b/build.zig index 45beeda..59c01db 100644 --- a/build.zig +++ b/build.zig @@ -34,8 +34,7 @@ pub fn build(b: *std.Build) void { const run_example = b.addRunArtifact(example); run_example.step.dependOn(b.getInstallStep()); - - if (b.args) |args| run_example.addArgs(args); + run_example.addPassthruArgs(); const run_step = b.step("example", "Run the example"); run_step.dependOn(&run_example.step); diff --git a/pretty.zig b/pretty.zig index cbd6744..8fcf57b 100644 --- a/pretty.zig +++ b/pretty.zig @@ -460,7 +460,7 @@ inline fn formatStruct( } comptime var index = 0; - inline for (st.fields) |field| { + inline for (st.field_names, 0..) |field, idx| { indent(next_ctx, next_ctx.options.struct_inline, run); if (index != 0 and ctx.options.struct_inline) { run.setColor(ctx, .dim); @@ -469,11 +469,25 @@ inline fn formatStruct( } run.setColor(ctx, .field); - try run.write("." ++ field.name ++ - ctx.options.theme.field_name_type_sep); + try run.write("." ++ field); + + if (st.field_attrs[idx].@"comptime") { + run.setColor(ctx, .dim); + try run.write(" [comptime]"); + run.resetColor(); + } + + if (st.field_attrs[idx].@"align") |a| { + run.setColor(ctx, .dim); + run.pretty(ctx, " align({})", .{a}); + run.resetColor(); + } + + run.setColor(ctx, .dim); + try run.write(ctx.options.theme.field_name_type_sep); run.resetColor(); - try innerFmt(field.type, next_ctx, run, @field(value, field.name), .{}); + try innerFmt(st.field_types[idx], next_ctx, run, @field(value, field), .{}); index += 1; } -- knotmirror 0.0.1