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",
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,

View file

@ -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 } };