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:
@@ -84,11 +84,7 @@ async fn test_basic_show_debug_panel(executor: BackgroundExecutor, cx: &mut Test
|
||||
debug_panel.update(cx, |debug_panel, _| debug_panel.active_session().unwrap());
|
||||
|
||||
let running_state = active_session.update(cx, |active_session, _| {
|
||||
active_session
|
||||
.mode()
|
||||
.as_running()
|
||||
.expect("Session should be running by this point")
|
||||
.clone()
|
||||
active_session.running_state().clone()
|
||||
});
|
||||
|
||||
debug_panel.update(cx, |this, cx| {
|
||||
@@ -120,11 +116,7 @@ async fn test_basic_show_debug_panel(executor: BackgroundExecutor, cx: &mut Test
|
||||
.unwrap();
|
||||
|
||||
let running_state = active_session.update(cx, |active_session, _| {
|
||||
active_session
|
||||
.mode()
|
||||
.as_running()
|
||||
.expect("Session should be running by this point")
|
||||
.clone()
|
||||
active_session.running_state().clone()
|
||||
});
|
||||
|
||||
assert_eq!(client.id(), running_state.read(cx).session_id());
|
||||
@@ -153,11 +145,7 @@ async fn test_basic_show_debug_panel(executor: BackgroundExecutor, cx: &mut Test
|
||||
.unwrap();
|
||||
|
||||
let running_state = active_session.update(cx, |active_session, _| {
|
||||
active_session
|
||||
.mode()
|
||||
.as_running()
|
||||
.expect("Session should be running by this point")
|
||||
.clone()
|
||||
active_session.running_state().clone()
|
||||
});
|
||||
|
||||
debug_panel.update(cx, |this, cx| {
|
||||
@@ -247,11 +235,7 @@ async fn test_we_can_only_have_one_panel_per_debug_session(
|
||||
.unwrap();
|
||||
|
||||
let running_state = active_session.update(cx, |active_session, _| {
|
||||
active_session
|
||||
.mode()
|
||||
.as_running()
|
||||
.expect("Session should be running by this point")
|
||||
.clone()
|
||||
active_session.running_state().clone()
|
||||
});
|
||||
|
||||
assert_eq!(client.id(), active_session.read(cx).session_id(cx));
|
||||
@@ -284,11 +268,7 @@ async fn test_we_can_only_have_one_panel_per_debug_session(
|
||||
.unwrap();
|
||||
|
||||
let running_state = active_session.update(cx, |active_session, _| {
|
||||
active_session
|
||||
.mode()
|
||||
.as_running()
|
||||
.expect("Session should be running by this point")
|
||||
.clone()
|
||||
active_session.running_state().clone()
|
||||
});
|
||||
|
||||
assert_eq!(client.id(), active_session.read(cx).session_id(cx));
|
||||
@@ -316,11 +296,7 @@ async fn test_we_can_only_have_one_panel_per_debug_session(
|
||||
.unwrap();
|
||||
|
||||
let running_state = active_session.update(cx, |active_session, _| {
|
||||
active_session
|
||||
.mode()
|
||||
.as_running()
|
||||
.expect("Session should be running by this point")
|
||||
.clone()
|
||||
active_session.running_state().clone()
|
||||
});
|
||||
|
||||
debug_panel.update(cx, |this, cx| {
|
||||
@@ -1009,12 +985,8 @@ async fn test_debug_panel_item_thread_status_reset_on_failure(
|
||||
|
||||
cx.run_until_parked();
|
||||
|
||||
let running_state = active_debug_session_panel(workspace, cx).update_in(cx, |item, _, _| {
|
||||
item.mode()
|
||||
.as_running()
|
||||
.expect("Session should be running by this point")
|
||||
.clone()
|
||||
});
|
||||
let running_state = active_debug_session_panel(workspace, cx)
|
||||
.update(cx, |item, _| item.running_state().clone());
|
||||
|
||||
cx.run_until_parked();
|
||||
let thread_id = ThreadId(1);
|
||||
|
||||
Reference in New Issue
Block a user