diff --git a/crates/debugger_tools/src/dap_log.rs b/crates/debugger_tools/src/dap_log.rs index e23f6bd85a8322..bd6ddacb79fbb2 100644 --- a/crates/debugger_tools/src/dap_log.rs +++ b/crates/debugger_tools/src/dap_log.rs @@ -168,9 +168,8 @@ impl LogStore { this.projects.remove(&weak_project); }), cx.subscribe(project, |this, project, event, cx| match event { - project::Event::DebugClientStarted((session_id, client_id)) => { + project::Event::DebugClientStarted((_, client_id)) => { this.add_debug_client( - *session_id, *client_id, project.update(cx, |project, cx| { project @@ -179,8 +178,8 @@ impl LogStore { }), ); } - project::Event::DebugClientShutdown((session_id, client_id)) => { - this.remove_debug_client(*session_id, *client_id, cx); + project::Event::DebugClientShutdown(client_id) => { + this.remove_debug_client(*client_id, cx); } _ => {} @@ -290,7 +289,6 @@ impl LogStore { fn add_debug_client( &mut self, - session_id: DebugSessionId, client_id: DebugAdapterClientId, session_and_client: Option<(Model, Arc)>, ) -> Option<&mut DebugAdapterState> { @@ -299,7 +297,7 @@ impl LogStore { .entry(client_id) .or_insert_with(DebugAdapterState::new); - if let Some((session, client)) = session_and_client { + if let Some((_, client)) = session_and_client { let io_tx = self.rpc_tx.clone(); client.add_log_handler( @@ -327,7 +325,6 @@ impl LogStore { fn remove_debug_client( &mut self, - session_id: DebugSessionId, client_id: DebugAdapterClientId, cx: &mut ModelContext, ) { @@ -409,11 +406,11 @@ impl Render for DapLogToolbarItemView { let menu_rows = menu_rows.clone(); ContextMenu::build(cx, move |mut menu, cx| { for row in menu_rows.into_iter() { - menu = menu.header(format!("{} ({})", row.session_name, row.session_id.0)); + menu = menu.header(format!("{}. {}", row.session_id.0, row.session_name)); for sub_item in row.clients.into_iter() { menu = menu.label(format!( - "{} ({})", + "{}. {}", sub_item.client_name, sub_item.client_id.0 )); diff --git a/crates/debugger_ui/src/debugger_panel.rs b/crates/debugger_ui/src/debugger_panel.rs index 799b24d0add27e..ff2d80eebe1348 100644 --- a/crates/debugger_ui/src/debugger_panel.rs +++ b/crates/debugger_ui/src/debugger_panel.rs @@ -181,7 +181,7 @@ impl DebugPanel { } _ => unreachable!(), }, - project::Event::DebugClientShutdown((session_id, client_id)) => { + project::Event::DebugClientShutdown(client_id) => { cx.emit(DebugPanelEvent::ClientShutdown(*client_id)); this.message_queue.remove(client_id); diff --git a/crates/project/src/dap_store.rs b/crates/project/src/dap_store.rs index accec3f11097a1..0bc30c8ad5d11c 100644 --- a/crates/project/src/dap_store.rs +++ b/crates/project/src/dap_store.rs @@ -58,7 +58,7 @@ use util::{merge_json_value_into, ResultExt as _}; pub enum DapStoreEvent { DebugClientStarted((DebugSessionId, DebugAdapterClientId)), - DebugClientShutdown((DebugSessionId, DebugAdapterClientId)), + DebugClientShutdown(DebugAdapterClientId), DebugClientEvent { session_id: DebugSessionId, client_id: DebugAdapterClientId, @@ -272,7 +272,7 @@ impl DapStore { cx: &mut ModelContext, ) { if let Some((session, _)) = self.client_by_id(client_id, cx) { - session.update(cx, |session, cx| { + session.update(cx, |session, _| { session.update_capabilities( client_id, session.capabilities(client_id).merge(other.clone()), @@ -716,7 +716,7 @@ impl DapStore { // update the process id on the config, so when the `startDebugging` reverse request // comes in we send another `attach` request with the already selected PID // If we don't do this the user has to select the process twice if the adapter sends a `startDebugging` request - session.update(cx, |session, cx| { + session.update(cx, |session, _| { session.update_configuration(|config| { config.request = DebugRequestType::Attach(task::AttachConfig { process_id: Some(process_id), @@ -1396,10 +1396,7 @@ impl DapStore { return Task::ready(Err(anyhow!("Could not find client: {:?}", client_id))); }; - cx.emit(DapStoreEvent::DebugClientShutdown(( - session.read(cx).id(), - *client_id, - ))); + cx.emit(DapStoreEvent::DebugClientShutdown(*client_id)); self.ignore_breakpoints.remove(client_id); let capabilities = session.read(cx).capabilities(client_id); @@ -1520,7 +1517,7 @@ impl DapStore { this.update(&mut cx, |dap_store, cx| { let session_id = DebugSessionId::from_proto(envelope.payload.session_id); if let Some(session) = dap_store.session_by_id(&session_id) { - session.update(cx, |session, cx| { + session.update(cx, |session, _| { session.update_capabilities( &DebugAdapterClientId::from_proto(envelope.payload.client_id), dap::proto_conversions::capabilities_from_proto(&envelope.payload), @@ -1539,10 +1536,9 @@ impl DapStore { ) -> Result<()> { this.update(&mut cx, |dap_store, cx| { if matches!(dap_store.mode, DapStoreMode::Remote(_)) { - let session_id = DebugSessionId::from_proto(envelope.payload.session_id); let client_id = DebugAdapterClientId::from_proto(envelope.payload.client_id); - cx.emit(DapStoreEvent::DebugClientShutdown((session_id, client_id))); + cx.emit(DapStoreEvent::DebugClientShutdown(client_id)); cx.notify(); } }) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index bfcdb7db4f6306..28f651f7b93269 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -253,7 +253,7 @@ pub enum Event { LanguageServerPrompt(LanguageServerPromptRequest), LanguageNotFound(Model), DebugClientStarted((DebugSessionId, DebugAdapterClientId)), - DebugClientShutdown((DebugSessionId, DebugAdapterClientId)), + DebugClientShutdown(DebugAdapterClientId), SetDebugClient(SetDebuggerPanelItem), ActiveDebugLineChanged, DebugClientEvent {