debugger: Extract running state from DebugSession mode and remove mode field (#29646)

DebugSession.mode is no longer needed because project::debugger::Session
manages its own state now (booting, running, terminated), and removing
mode simplifies a lot of the code that uses running state.

I used Zed AI to do a good chunk of the refactor, but I doubled-checked
everything it did and changed a good amount of its updates.

Release Notes:

- N/A

Co-authored-by: Zed AI <ai@zed.dev>
This commit is contained in:
Anthony Eid
2025-04-30 05:57:53 +00:00
committed by GitHub
co-authored by Zed AI
parent edf78e770d
commit 9767033985
9 changed files with 158 additions and 288 deletions
+3 -6
View File
@@ -87,10 +87,7 @@ async fn test_handle_output_event(executor: BackgroundExecutor, cx: &mut TestApp
let running_state =
active_debug_session_panel(workspace, cx).update_in(cx, |item, window, cx| {
cx.focus_self(window);
item.mode()
.as_running()
.expect("Session should be running by this point")
.clone()
item.running_state().clone()
});
cx.run_until_parked();
@@ -105,7 +102,7 @@ async fn test_handle_output_event(executor: BackgroundExecutor, cx: &mut TestApp
assert_eq!(
"First console output line before thread stopped!\nFirst output line before thread stopped!\n",
active_debug_session_panel.read(cx).mode().as_running().unwrap().read(cx).console().read(cx).editor().read(cx).text(cx).as_str()
active_debug_session_panel.read(cx).running_state().read(cx).console().read(cx).editor().read(cx).text(cx).as_str()
);
})
.unwrap();
@@ -154,7 +151,7 @@ async fn test_handle_output_event(executor: BackgroundExecutor, cx: &mut TestApp
assert_eq!(
"First console output line before thread stopped!\nFirst output line before thread stopped!\nSecond output line after thread stopped!\nSecond console output line after thread stopped!\n",
active_session_panel.read(cx).mode().as_running().unwrap().read(cx).console().read(cx).editor().read(cx).text(cx).as_str()
active_session_panel.read(cx).running_state().read(cx).console().read(cx).editor().read(cx).text(cx).as_str()
);
})
.unwrap();