debugger: Fix spec violation with threads request being issued before debug session is initialized (#33627)

Piotr Osiewicz created

Follow-up to #32852. This time we'll check if the debug session is
initialized before querying threads.

Release Notes:

- Fix Zed's debugger issuing threads request before it is allowed to do
so per DAP specification.

Change summary

crates/debugger_ui/src/debugger_panel.rs          | 2 +-
crates/debugger_ui/src/session/running/console.rs | 2 +-
crates/project/src/debugger/session.rs            | 4 ----
3 files changed, 2 insertions(+), 6 deletions(-)

Detailed changes

crates/debugger_ui/src/debugger_panel.rs 🔗

@@ -868,7 +868,7 @@ impl DebugPanel {
                                         let threads =
                                             running_state.update(cx, |running_state, cx| {
                                                 let session = running_state.session();
-                                                session.read(cx).is_running().then(|| {
+                                                session.read(cx).is_started().then(|| {
                                                     session.update(cx, |session, cx| {
                                                         session.threads(cx)
                                                     })

crates/project/src/debugger/session.rs 🔗

@@ -1037,10 +1037,6 @@ impl Session {
         matches!(self.mode, Mode::Building)
     }
 
-    pub fn is_running(&self) -> bool {
-        matches!(self.mode, Mode::Running(_))
-    }
-
     pub fn as_running_mut(&mut self) -> Option<&mut RunningMode> {
         match &mut self.mode {
             Mode::Running(local_mode) => Some(local_mode),