Debugger: Fix breakpoint serialization (#27825)

This PR fixes two bugs that cause unexpected behavior with breakpoints.

The first bug made it impossible to delete the last breakpoint in a file
in the workspace's database. This caused deleted breakpoints to remain
in the database and added to new projects.

The second bug was an edge case in the breakpoint context menu where
disabling/enabling a breakpoint would sometimes set a new breakpoint on
top of the old breakpoint.


Release Notes:

- N/A
This commit is contained in:
Anthony Eid 2025-04-01 01:40:05 -04:00 committed by GitHub
parent d0276e6666
commit 8075c2458f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 124 additions and 18 deletions

View file

@ -988,10 +988,12 @@ impl Workspace {
cx.subscribe_in(
&project.read(cx).breakpoint_store(),
window,
|workspace, _, evt, window, cx| {
if let BreakpointStoreEvent::BreakpointsUpdated(_, _) = evt {
|workspace, _, event, window, cx| match event {
BreakpointStoreEvent::BreakpointsUpdated(_, _)
| BreakpointStoreEvent::BreakpointsCleared(_) => {
workspace.serialize_workspace(window, cx);
}
BreakpointStoreEvent::ActiveDebugLineChanged => {}
},
)
.detach();