Serialize breakpoints when changing the state of a breakpoint (#27373)

This fixes a rare bug where a breakpoint isn't saved in the database
when a user toggles a breakpoint and immediately exits out of zed.

Release Notes:

- N/A

Co-authored-by: Piotr Osiewicz <peterosiewicz@gmail.com>
This commit is contained in:
Anthony Eid 2025-03-24 12:25:17 -04:00 committed by GitHub
parent a23e293ca2
commit 350c1e41d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -65,7 +65,8 @@ use persistence::{
};
use postage::stream::Stream;
use project::{
DirectoryLister, Project, ProjectEntryId, ProjectPath, ResolvedPath, Worktree, WorktreeId,
debugger::breakpoint_store::BreakpointStoreEvent, DirectoryLister, Project, ProjectEntryId,
ProjectPath, ResolvedPath, Worktree, WorktreeId,
};
use remote::{ssh_session::ConnectionIdentifier, SshClientDelegate, SshConnectionOptions};
use schemars::JsonSchema;
@ -974,6 +975,17 @@ impl Workspace {
})
.detach();
cx.subscribe_in(
&project.read(cx).breakpoint_store(),
window,
|workspace, _, evt, window, cx| {
if let BreakpointStoreEvent::BreakpointsUpdated(_, _) = evt {
workspace.serialize_workspace(window, cx);
}
},
)
.detach();
cx.on_focus_lost(window, |this, window, cx| {
let focus_handle = this.focus_handle(cx);
window.focus(&focus_handle);