diff --git a/crates/debugger_tools/src/dap_log.rs b/crates/debugger_tools/src/dap_log.rs index 115f1a5f52..b34e812876 100644 --- a/crates/debugger_tools/src/dap_log.rs +++ b/crates/debugger_tools/src/dap_log.rs @@ -113,8 +113,7 @@ impl LogStore { }) .detach_and_log_err(cx); - let (adapter_log_tx, mut adapter_log_rx) = - unbounded::<(SessionId, IoKind, String)>(); + let (adapter_log_tx, mut adapter_log_rx) = unbounded::<(SessionId, IoKind, String)>(); cx.spawn(|this, mut cx| async move { while let Some((client_id, io_kind, message)) = adapter_log_rx.next().await { if let Some(this) = this.upgrade() { @@ -170,7 +169,7 @@ impl LogStore { let client = project.update(cx, |project, cx| { project.dap_store().update(cx, |store, cx| { store - .client_by_id(client_id) + .session_by_id(client_id) .and_then(|client| Some(client)) }) }); @@ -189,10 +188,7 @@ impl LogStore { ); } - fn get_debug_adapter_state( - &mut self, - id: SessionId, - ) -> Option<&mut DebugAdapterState> { + fn get_debug_adapter_state(&mut self, id: SessionId) -> Option<&mut DebugAdapterState> { self.debug_clients.get_mut(&id) } @@ -328,17 +324,11 @@ impl LogStore { cx.notify(); } - fn log_messages_for_client( - &mut self, - client_id: SessionId, - ) -> Option<&mut VecDeque> { + fn log_messages_for_client(&mut self, client_id: SessionId) -> Option<&mut VecDeque> { Some(&mut self.debug_clients.get_mut(&client_id)?.log_messages) } - fn rpc_messages_for_client( - &mut self, - client_id: SessionId, - ) -> Option<&mut VecDeque> { + fn rpc_messages_for_client(&mut self, client_id: SessionId) -> Option<&mut VecDeque> { Some( &mut self .debug_clients @@ -568,7 +558,7 @@ impl DapLogView { .read(cx) .dap_store() .read(cx) - .clients() + .sessions() .filter_map(|client| { let client = client.read(cx).adapter_client()?; Some(DapMenuItem { diff --git a/crates/debugger_ui/src/attach_modal.rs b/crates/debugger_ui/src/attach_modal.rs index 328e1b1e76..37d2d04b11 100644 --- a/crates/debugger_ui/src/attach_modal.rs +++ b/crates/debugger_ui/src/attach_modal.rs @@ -128,7 +128,7 @@ impl PickerDelegate for AttachModalDelegate { } else { let Some(client) = this.delegate.dap_store.update(cx, |store, cx| { store - .client_by_id(&this.delegate.client_id) + .session_by_id(&this.delegate.client_id) .and_then(|client| client.read(cx).adapter_client()) }) else { return Vec::new(); diff --git a/crates/project/src/debugger/dap_store.rs b/crates/project/src/debugger/dap_store.rs index 4578a8c67e..24da8c6f38 100644 --- a/crates/project/src/debugger/dap_store.rs +++ b/crates/project/src/debugger/dap_store.rs @@ -353,7 +353,7 @@ impl DapStore { } } - pub fn client_by_id( + pub fn session_by_id( &self, session_id: impl Borrow, ) -> Option> { @@ -362,7 +362,7 @@ impl DapStore { client } - pub fn clients(&self) -> impl Iterator> { + pub fn sessions(&self) -> impl Iterator> { self.sessions.values() } @@ -383,7 +383,7 @@ impl DapStore { capabilities: &Capabilities, cx: &mut Context, ) { - if let Some(client) = self.client_by_id(session_id) { + if let Some(client) = self.session_by_id(session_id) { client.update(cx, |this, cx| { this.capabilities = this.capabilities.merge(capabilities.clone()); }); @@ -450,7 +450,7 @@ impl DapStore { let session_id = SessionId::from_proto(envelope.payload.session_id); this.update(&mut cx, |this, cx| { - if let Some(client) = this.client_by_id(&session_id) { + if let Some(client) = this.session_by_id(&session_id) { client.update(cx, |client, cx| { client.set_ignore_breakpoints(envelope.payload.ignore) }); @@ -466,7 +466,7 @@ impl DapStore { ignore: bool, cx: &mut Context, ) { - if let Some(session) = self.client_by_id(session_id) { + if let Some(session) = self.session_by_id(session_id) { session.update(cx, |session, _| { session.set_ignore_breakpoints(ignore); }); @@ -474,13 +474,13 @@ impl DapStore { } pub fn ignore_breakpoints(&self, session_id: &SessionId, cx: &App) -> bool { - self.client_by_id(session_id) + self.session_by_id(session_id) .map(|client| client.read(cx).breakpoints_enabled()) .unwrap_or_default() } pub fn toggle_ignore_breakpoints(&mut self, session_id: &SessionId, cx: &mut Context) { - if let Some(client) = self.client_by_id(session_id) { + if let Some(client) = self.session_by_id(session_id) { client.update(cx, |client, _| { client.set_ignore_breakpoints(!client.breakpoints_enabled()); }); @@ -659,7 +659,7 @@ impl DapStore { cx: &mut Context, ) -> Task> { let Some(client) = self - .client_by_id(session_id) + .session_by_id(session_id) .and_then(|client| client.read(cx).adapter_client()) else { return Task::ready(Err(anyhow!("Could not find client: {:?}", session_id))); @@ -768,7 +768,7 @@ impl DapStore { cx: &mut Context, ) -> Task> { let Some(client) = self - .client_by_id(session_id) + .session_by_id(session_id) .and_then(|client| client.read(cx).adapter_client()) else { return Task::ready(Err(anyhow!( @@ -800,7 +800,7 @@ impl DapStore { cx: &mut Context, ) -> Task> { let Some(client) = self - .client_by_id(session_id) + .session_by_id(session_id) .and_then(|client| client.read(cx).adapter_client()) else { return Task::ready(Err(anyhow!("Could not find client: {:?}", session_id))); @@ -830,7 +830,7 @@ impl DapStore { cx: &mut Context, ) -> Task>> { let Some(client) = self - .client_by_id(session_id) + .session_by_id(session_id) .and_then(|client| client.read(cx).adapter_client()) else { return Task::ready(Err(anyhow!("Could not find client: {:?}", session_id))); @@ -861,7 +861,7 @@ impl DapStore { cx: &mut Context, ) -> Task> { let Some(client) = self - .client_by_id(session_id) + .session_by_id(session_id) .and_then(|client| client.read(cx).adapter_client()) else { return Task::ready(Err(anyhow!("Could not find client: {:?}", session_id))); @@ -1035,7 +1035,7 @@ impl DapStore { this.update(&mut cx, |dap_store, cx| { let session_id = SessionId::from_proto(envelope.payload.session_id); - dap_store.client_by_id(session_id).map(|state| { + dap_store.session_by_id(session_id).map(|state| { state.update(cx, |state, cx| { state.shutdown(cx); }) @@ -1093,7 +1093,7 @@ impl DapStore { cx: &App, ) -> Task> { let Some(client) = self - .client_by_id(session_id) + .session_by_id(session_id) .and_then(|client| client.read(cx).adapter_client()) else { return Task::ready(Err(anyhow!("Could not find client: {:?}", session_id)));