ziglang / zig.vim

Vim configuration for Zig
MIT License
448 stars 56 forks source link

zig_fmt_autosave | Trailing comma in function args raises an error #77

Closed BenLeadbetter closed 1 year ago

BenLeadbetter commented 2 years ago

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.

matu3ba commented 1 year ago

I can not reproduce this on neovim. Suggestion to close this.

BenLeadbetter commented 1 year ago

Yep I can't repro the bug any more.