feat: add show_local_diagnostics_in_panel config option

This commit is contained in:
CJ van den Berg 2025-12-03 16:41:29 +01:00
parent d16e64963e
commit 60ba0e6544
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 16 additions and 13 deletions

View file

@ -40,6 +40,7 @@ top_bar: []const u8 = "tabs",
bottom_bar: []const u8 = "mode file log selection diagnostics keybind branch linenumber clock spacer", bottom_bar: []const u8 = "mode file log selection diagnostics keybind branch linenumber clock spacer",
show_scrollbars: bool = true, show_scrollbars: bool = true,
show_fileicons: bool = true, show_fileicons: bool = true,
show_local_diagnostics_in_panel: bool = false,
scrollbar_auto_hide: bool = false, scrollbar_auto_hide: bool = false,
start_debugger_on_crash: bool = false, start_debugger_on_crash: bool = false,

View file

@ -968,19 +968,21 @@ const cmds = struct {
tp.extract(&sel.end.col), tp.extract(&sel.end.col),
})) return error.InvalidAddDiagnosticArgument; })) return error.InvalidAddDiagnosticArgument;
file_path = project_manager.normalize_file_path(file_path); 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 "")) 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) try editor.add_diagnostic(file_path, source, code, message, severity, sel);
else if (!tui.config().show_local_diagnostics_in_panel)
try self.add_find_in_files_result( return;
.diagnostics, };
file_path, try self.add_find_in_files_result(
sel.begin.row + 1, .diagnostics,
sel.begin.col, file_path,
sel.end.row + 1, sel.begin.row + 1,
sel.end.col, sel.begin.col,
message, sel.end.row + 1,
ed.Diagnostic.to_severity(severity), 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 } }; pub const add_diagnostic_meta: Meta = .{ .arguments = &.{ .string, .string, .string, .string, .integer, .integer, .integer, .integer, .integer } };