zls icon indicating copy to clipboard operation
zls copied to clipboard

Apply multiple autofixes in a row when one reveals another

Open SuperAuguste opened this issue 2 years ago • 2 comments

Let's assume https://github.com/zigtools/zls/pull/1476 is merged;

pub fn main() void {
    var a = 1
}

Save once and it adds ;, save again and it adds an unused discard. This isn't great. :(

SuperAuguste avatar Oct 01 '23 05:10 SuperAuguste

Is the following related to the this problem or should I open another issue?

When having this line:

pub fn format(self: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {}

After the first safe I get:

pub fn format(self: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
    _ = writer;
    _ = options;
    _ = fmt;
    _ = self;}

Note the closing curly brace. After a second safe I get the expected output:

pub fn format(self: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
    _ = writer;
    _ = options;
    _ = fmt;
    _ = self;
}

TheFunctionalGuy avatar Oct 15 '23 01:10 TheFunctionalGuy

Is the following related to the this problem or should I open another issue?

I think this should be tracked as a separate issue.

Techatrix avatar Oct 21 '23 12:10 Techatrix