fix: clear diagnostics when switching projects

This commit is contained in:
CJ van den Berg 2024-08-19 21:12:30 +02:00
parent e6db0ce970
commit 321128a22a

View file

@ -244,13 +244,16 @@ const cmds = struct {
if (editor.is_dirty()) if (editor.is_dirty())
return tp.exit("unsaved changes"); return tp.exit("unsaved changes");
self.clear_file_stack(); self.clear_file_stack();
editor.clear_diagnostics();
try editor.close_file(.{}); try editor.close_file(.{});
} else { } else {
self.clear_file_stack(); self.clear_file_stack();
} }
self.clear_find_in_files_results(.diagnostics);
if (self.file_list_type == .diagnostics and self.is_panel_view_showing(filelist_view))
try self.toggle_panel_view(filelist_view, false);
try project_manager.open(project_dir); try project_manager.open(project_dir);
_ = try self.statusbar.msg(.{ "PRJ", "open" }); _ = try self.statusbar.msg(.{ "PRJ", "open" });
log.logger("project").print("switched to project {s}", .{project_dir});
} }
pub fn navigate(self: *Self, ctx: Ctx) Result { pub fn navigate(self: *Self, ctx: Ctx) Result {