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
+5 -22
View File
@@ -183,10 +183,7 @@ async fn test_basic_fetch_initial_scope_and_variables(
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();
@@ -427,10 +424,7 @@ async fn test_fetch_variables_for_multiple_scopes(
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();
@@ -710,11 +704,7 @@ async fn test_keyboard_navigation(executor: BackgroundExecutor, cx: &mut TestApp
let running_state =
active_debug_session_panel(workspace, cx).update_in(cx, |item, window, cx| {
cx.focus_self(window);
let running = item
.mode()
.as_running()
.expect("Session should be running by this point")
.clone();
let running = item.running_state().clone();
let variable_list = running.read_with(cx, |state, _| state.variable_list().clone());
variable_list.update(cx, |_, cx| cx.focus_self(window));
@@ -1440,11 +1430,7 @@ async fn test_variable_list_only_sends_requests_when_rendering(
cx.run_until_parked();
let running_state = active_debug_session_panel(workspace, cx).update_in(cx, |item, _, _| {
let state = item
.mode()
.as_running()
.expect("Session should be running by this point")
.clone();
let state = item.running_state().clone();
state
});
@@ -1742,10 +1728,7 @@ async fn test_it_fetches_scopes_variables_when_you_select_a_stack_frame(
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()
});
running_state.update(cx, |running_state, cx| {