From 60ba0e654489089d5a22b85d11031018b97ee2d5 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 3 Dec 2025 16:41:29 +0100 Subject: [PATCH] feat: add show_local_diagnostics_in_panel config option --- src/config.zig | 1 + src/tui/mainview.zig | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/config.zig b/src/config.zig index fb04be4..d8fae6e 100644 --- a/src/config.zig +++ b/src/config.zig @@ -40,6 +40,7 @@ top_bar: []const u8 = "tabs", bottom_bar: []const u8 = "mode file log selection diagnostics keybind branch linenumber clock spacer", show_scrollbars: bool = true, show_fileicons: bool = true, +show_local_diagnostics_in_panel: bool = false, scrollbar_auto_hide: bool = false, start_debugger_on_crash: bool = false, diff --git a/src/tui/mainview.zig b/src/tui/mainview.zig index 7a38573..47f7ae4 100644 --- a/src/tui/mainview.zig +++ b/src/tui/mainview.zig @@ -968,19 +968,21 @@ const cmds = struct { tp.extract(&sel.end.col), })) return error.InvalidAddDiagnosticArgument; file_path = project_manager.normalize_file_path(file_path); - if (self.get_active_editor()) |editor| if (std.mem.eql(u8, file_path, editor.file_path orelse "")) - try editor.add_diagnostic(file_path, source, code, message, severity, sel) - else - try self.add_find_in_files_result( - .diagnostics, - file_path, - sel.begin.row + 1, - sel.begin.col, - sel.end.row + 1, - sel.end.col, - message, - ed.Diagnostic.to_severity(severity), - ); + if (self.get_active_editor()) |editor| if (std.mem.eql(u8, file_path, editor.file_path orelse "")) { + try editor.add_diagnostic(file_path, source, code, message, severity, sel); + if (!tui.config().show_local_diagnostics_in_panel) + return; + }; + try self.add_find_in_files_result( + .diagnostics, + file_path, + sel.begin.row + 1, + sel.begin.col, + sel.end.row + 1, + sel.end.col, + message, + ed.Diagnostic.to_severity(severity), + ); } pub const add_diagnostic_meta: Meta = .{ .arguments = &.{ .string, .string, .string, .string, .integer, .integer, .integer, .integer, .integer } };