u/akhilgod

Zig formatting long lines with a simple comma ","
▲ 24 r/Zig

Zig formatting long lines with a simple comma ","

Found adding comma "," at the end of arguments in a function or tuple zig fmt places all parameters in new lines.

Without Comma:

const exe = b.addExecutable(.{ .name = "flora64-geojson-merge", .root_module = b.createModule(.{ .root_source_file = b.path("src/bin/geojson.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "flora64", .module = flora64_mod }} }) });

With Comma:

const exe = b.addExecutable(.{
        .name = "flora64-geojson-merge",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/bin/geojson.zig"),
            .target = target,
            .optimize = optimize,
            .imports = &.{.{ .name = "flora64", .module = flora64_mod }},
        }),
    });

Reference: https://github.com/ziglang/zig/issues/3057

u/akhilgod — 8 days ago