feat: open most recent file on project switch

This commit is contained in:
CJ van den Berg 2024-08-19 22:44:57 +02:00
parent 53310cc2dd
commit bd27db46d1
3 changed files with 27 additions and 0 deletions

View file

@ -258,6 +258,10 @@ const cmds = struct {
const project = tp.env.get().str("project");
tui.current().rdr.set_terminal_working_directory(project);
_ = try self.statusbar.msg(.{ "PRJ", "open" });
if (try project_manager.request_most_recent_file(self.a)) |file_path| {
defer self.a.free(file_path);
try tp.self_pid().send(.{ "cmd", "navigate", .{ .file = file_path } });
}
}
pub fn navigate(self: *Self, ctx: Ctx) Result {