diff --git a/crates/dap_adapters/src/dap_adapters.rs b/crates/dap_adapters/src/dap_adapters.rs index de9c2b86d6..ddcaeff314 100644 --- a/crates/dap_adapters/src/dap_adapters.rs +++ b/crates/dap_adapters/src/dap_adapters.rs @@ -2,7 +2,6 @@ mod codelldb; mod gdb; mod go; mod javascript; -mod lldb; mod php; mod python; @@ -21,7 +20,6 @@ use dap::{ use gdb::GdbDebugAdapter; use go::GoDebugAdapter; use javascript::JsDebugAdapter; -use lldb::LldbDebugAdapter; use php::PhpDebugAdapter; use python::PythonDebugAdapter; use serde_json::{Value, json}; @@ -32,7 +30,6 @@ pub fn init(registry: Arc) { registry.add_adapter(Arc::from(PythonDebugAdapter)); registry.add_adapter(Arc::from(PhpDebugAdapter)); registry.add_adapter(Arc::from(JsDebugAdapter)); - registry.add_adapter(Arc::from(LldbDebugAdapter)); registry.add_adapter(Arc::from(GoDebugAdapter)); registry.add_adapter(Arc::from(GdbDebugAdapter)); } diff --git a/crates/dap_adapters/src/lldb.rs b/crates/dap_adapters/src/lldb.rs deleted file mode 100644 index 763d783d57..0000000000 --- a/crates/dap_adapters/src/lldb.rs +++ /dev/null @@ -1,105 +0,0 @@ -use std::{ffi::OsStr, path::PathBuf}; - -use anyhow::Result; -use async_trait::async_trait; -use gpui::AsyncApp; -use task::{DebugRequestType, DebugTaskDefinition}; - -use crate::*; - -#[derive(Default)] -pub(crate) struct LldbDebugAdapter; - -impl LldbDebugAdapter { - const ADAPTER_NAME: &'static str = "LLDB"; - - fn request_args(&self, config: &DebugTaskDefinition) -> dap::StartDebuggingRequestArguments { - let request = config.request.to_dap(); - let mut args = json!({ - "request": match config.request { - DebugRequestType::Launch(_) => "launch", - DebugRequestType::Attach(_) => "attach", - }, - }); - let map = args.as_object_mut().unwrap(); - match &config.request { - DebugRequestType::Attach(attach) => { - map.insert("pid".into(), attach.process_id.into()); - } - DebugRequestType::Launch(launch) => { - map.insert("program".into(), launch.program.clone().into()); - - if !launch.args.is_empty() { - map.insert("args".into(), launch.args.clone().into()); - } - - if let Some(stop_on_entry) = config.stop_on_entry { - map.insert("stopOnEntry".into(), stop_on_entry.into()); - } - if let Some(cwd) = launch.cwd.as_ref() { - map.insert("cwd".into(), cwd.to_string_lossy().into_owned().into()); - } - } - } - dap::StartDebuggingRequestArguments { - request, - configuration: args, - } - } -} - -#[async_trait(?Send)] -impl DebugAdapter for LldbDebugAdapter { - fn name(&self) -> DebugAdapterName { - DebugAdapterName(Self::ADAPTER_NAME.into()) - } - - async fn get_binary( - &self, - delegate: &dyn DapDelegate, - config: &DebugTaskDefinition, - user_installed_path: Option, - _: &mut AsyncApp, - ) -> Result { - let lldb_dap_path = if let Some(user_installed_path) = user_installed_path { - user_installed_path.to_string_lossy().into() - } else { - delegate - .which(OsStr::new("lldb-dap")) - .and_then(|p| p.to_str().map(|s| s.to_string())) - .ok_or(anyhow!("Could not find lldb-dap in path"))? - }; - - Ok(DebugAdapterBinary { - adapter_name: Self::ADAPTER_NAME.into(), - command: lldb_dap_path, - arguments: None, - envs: None, - cwd: None, - connection: None, - request_args: self.request_args(config), - }) - } - - async fn install_binary( - &self, - _version: AdapterVersion, - _delegate: &dyn DapDelegate, - ) -> Result<()> { - unimplemented!("LLDB debug adapter cannot be installed by Zed (yet)") - } - - async fn fetch_latest_adapter_version(&self, _: &dyn DapDelegate) -> Result { - unimplemented!("Fetch latest adapter version not implemented for lldb (yet)") - } - - async fn get_installed_binary( - &self, - _: &dyn DapDelegate, - _: &DebugTaskDefinition, - _: Option, - _: &mut AsyncApp, - ) -> Result { - unimplemented!("LLDB debug adapter cannot be installed by Zed (yet)") - } -} diff --git a/crates/languages/src/rust.rs b/crates/languages/src/rust.rs index ea69d1b1d9..7c3c651a07 100644 --- a/crates/languages/src/rust.rs +++ b/crates/languages/src/rust.rs @@ -682,7 +682,7 @@ impl ContextProvider for RustContextProvider { RUST_PACKAGE_TASK_VARIABLE.template_value(), ), task_type: TaskType::Debug(task::DebugArgs { - adapter: "LLDB".to_owned(), + adapter: "CodeLLDB".to_owned(), request: task::DebugArgsRequest::Launch, locator: Some("cargo".into()), tcp_connection: None, @@ -791,7 +791,7 @@ impl ContextProvider for RustContextProvider { command: "cargo".into(), task_type: TaskType::Debug(task::DebugArgs { request: task::DebugArgsRequest::Launch, - adapter: "LLDB".to_owned(), + adapter: "CodeLLDB".to_owned(), initialize_args: None, locator: Some("cargo".into()), tcp_connection: None,