Writing Zig files deletes newlines at the start of a block. #7361
-
SummaryWhenever I write a Zig file to disk, Helix deletes all empty lines at the start of any block. Reproduction StepsI was playing with this Zig code from their docs: const std = @import("std");
pub fn main() !void {
std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
const stdout_file = std.io.getStdOut().writer();
var writer = std.io.bufferedWriter(stdout_file);
const stdout = writer.writer();
try stdout.print("Run `zig build test` to run the tests.\n", .{});
try writer.flush(); // don't forget to flush!
}
test "simple test" {
var list = std.ArrayList(i32).init(std.testing.allocator);
defer list.deinit();
try list.append(42);
try std.testing.expectEqual(@as(i32, 42), list.pop());
} Whenever I write the file to disk, Helix removes the empty line at the start of the function and at the start of the test block. This happens with or without the LSP ( If I have more than one empty line (at the start of a block), all of the empty lines will be deleted. This behavior changes if I start the block with a comment. Then, Helix will only remove empty lines before the comment if there is more than one (empty line), leaving a single empty line before the comment. Helix logn/a PlatformmacOS Ventura 13.4 Terminal EmulatoriTerm2 3.4.19 Helix Versionhelix 23.05 (7f5940b) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Disable auto-format. For zig, the LSP isn't used for it, and instead |
Beta Was this translation helpful? Give feedback.
Disable auto-format. For zig, the LSP isn't used for it, and instead
zig fmt
is called