From 39f05aee96585ecf5b280dea73b9bd279385dbd2 Mon Sep 17 00:00:00 2001 From: Loris Cro Date: Tue, 20 Feb 2024 20:58:47 +0100 Subject: [PATCH] update diagnostic usage --- src/cli/fmt.zig | 4 ++-- src/cli/lsp.zig | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cli/fmt.zig b/src/cli/fmt.zig index c6feefd..1f7dee9 100644 --- a/src/cli/fmt.zig +++ b/src/cli/fmt.zig @@ -18,8 +18,8 @@ pub fn run(gpa: std.mem.Allocator, args: []const []const u8) !void { const code = try buf.toOwnedSliceSentinel(0); - var diag: Diagnostic = .{}; - const ast = Ast.init(gpa, code, null, true, &diag) catch { + var diag: Diagnostic = .{ .path = null }; + const ast = Ast.init(gpa, code, true, &diag) catch { std.debug.print("{}", .{diag}); std.process.exit(1); }; diff --git a/src/cli/lsp.zig b/src/cli/lsp.zig index d6a9f4a..d950803 100644 --- a/src/cli/lsp.zig +++ b/src/cli/lsp.zig @@ -154,9 +154,9 @@ const Handler = struct { var buf = std.ArrayList(u8).init(self.gpa); defer buf.deinit(); - var diag: ziggy.Diagnostic = .{}; + var diag: ziggy.Diagnostic = .{ .path = null }; - const ast = ziggy.Ast.init(self.gpa, new_text, null, true, &diag) catch undefined; + const ast = ziggy.Ast.init(self.gpa, new_text, true, &diag) catch undefined; defer if (std.meta.activeTag(diag.err) == .none) ast.deinit(); if (std.meta.activeTag(diag.err) != .none) {