fix: set project correctly on restart

This commit is contained in:
CJ van den Berg 2024-10-28 19:58:47 +01:00
parent bd62dfcdc1
commit d0de867d91
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 5 additions and 1 deletions

View file

@ -453,7 +453,8 @@ pub const Editor = struct {
else
syntax.create_guess_file_type(self.allocator, content.items, self.file_path) catch null;
if (syn) |syn_|
project_manager.did_open(file_path, syn_.file_type, self.lsp_version, try content.toOwnedSlice()) catch {};
project_manager.did_open(file_path, syn_.file_type, self.lsp_version, try content.toOwnedSlice()) catch |e|
self.logger.print("project_manager.did_open failed: {any}", .{e});
break :syntax syn;
};
self.syntax_no_render = tp.env.get().is("no-syntax");

View file

@ -363,6 +363,9 @@ const cmds = struct {
pub const open_config_meta = .{ .description = "Edit configuration file" };
pub fn restore_session(self: *Self, _: Ctx) Result {
if (tp.env.get().str("project").len == 0) {
try open_project_cwd(self, .{});
}
try self.create_editor();
try self.read_restore_info();
tui.need_render();