zig.vim icon indicating copy to clipboard operation
zig.vim copied to clipboard

zig_fmt_autosave | Trailing comma in function args raises an error

Open BenLeadbetter opened this issue 3 years ago • 0 comments

With zig_fmt_autosave enabled, the following file causes an error to be raised on save.

const std = @import("std");
test "format bug" {
    std.debug.print("Hello, World!",);
}

The error:

Error detected while processing function <SNR>17_fmt_autosave[2]..zig#fmt#Format:
line   39:
"format-bug.zig" 5L, 90C written

It seems this is a bug in the vim plugin, because if I run the zig fmt command on the same file from the command line the file is formatted correctly - that is the args of print are wrapped onto new lines because of the trailing comma.

BenLeadbetter avatar Jul 14 '22 09:07 BenLeadbetter