extension: Another batch of updates for DAP extension API (#32809)
Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
4383fee3c1
commit
0f0ff40c6d
19 changed files with 142 additions and 107 deletions
|
@ -19,7 +19,7 @@ pub(crate) struct CodeLldbDebugAdapter {
|
|||
impl CodeLldbDebugAdapter {
|
||||
const ADAPTER_NAME: &'static str = "CodeLLDB";
|
||||
|
||||
fn request_args(
|
||||
async fn request_args(
|
||||
&self,
|
||||
delegate: &Arc<dyn DapDelegate>,
|
||||
task_definition: &DebugTaskDefinition,
|
||||
|
@ -37,7 +37,7 @@ impl CodeLldbDebugAdapter {
|
|||
obj.entry("cwd")
|
||||
.or_insert(delegate.worktree_root_path().to_string_lossy().into());
|
||||
|
||||
let request = self.request_kind(&configuration)?;
|
||||
let request = self.request_kind(&configuration).await?;
|
||||
|
||||
Ok(dap::StartDebuggingRequestArguments {
|
||||
request,
|
||||
|
@ -89,7 +89,7 @@ impl DebugAdapter for CodeLldbDebugAdapter {
|
|||
DebugAdapterName(Self::ADAPTER_NAME.into())
|
||||
}
|
||||
|
||||
fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
async fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
let mut configuration = json!({
|
||||
"request": match zed_scenario.request {
|
||||
DebugRequest::Launch(_) => "launch",
|
||||
|
@ -368,7 +368,7 @@ impl DebugAdapter for CodeLldbDebugAdapter {
|
|||
"--settings".into(),
|
||||
json!({"sourceLanguages": ["cpp", "rust"]}).to_string(),
|
||||
],
|
||||
request_args: self.request_args(delegate, &config)?,
|
||||
request_args: self.request_args(delegate, &config).await?,
|
||||
envs: HashMap::default(),
|
||||
connection: None,
|
||||
})
|
||||
|
|
|
@ -21,7 +21,7 @@ impl DebugAdapter for GdbDebugAdapter {
|
|||
DebugAdapterName(Self::ADAPTER_NAME.into())
|
||||
}
|
||||
|
||||
fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
async fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
let mut obj = serde_json::Map::default();
|
||||
|
||||
match &zed_scenario.request {
|
||||
|
@ -191,7 +191,7 @@ impl DebugAdapter for GdbDebugAdapter {
|
|||
cwd: Some(delegate.worktree_root_path().to_path_buf()),
|
||||
connection: None,
|
||||
request_args: StartDebuggingRequestArguments {
|
||||
request: self.request_kind(&config.config)?,
|
||||
request: self.request_kind(&config.config).await?,
|
||||
configuration,
|
||||
},
|
||||
})
|
||||
|
|
|
@ -352,7 +352,7 @@ impl DebugAdapter for GoDebugAdapter {
|
|||
})
|
||||
}
|
||||
|
||||
fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
async fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
let mut args = match &zed_scenario.request {
|
||||
dap::DebugRequest::Attach(attach_config) => {
|
||||
json!({
|
||||
|
@ -495,7 +495,7 @@ impl DebugAdapter for GoDebugAdapter {
|
|||
connection,
|
||||
request_args: StartDebuggingRequestArguments {
|
||||
configuration,
|
||||
request: self.request_kind(&task_definition.config)?,
|
||||
request: self.request_kind(&task_definition.config).await?,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ impl JsDebugAdapter {
|
|||
}),
|
||||
request_args: StartDebuggingRequestArguments {
|
||||
configuration,
|
||||
request: self.request_kind(&task_definition.config)?,
|
||||
request: self.request_kind(&task_definition.config).await?,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ impl DebugAdapter for JsDebugAdapter {
|
|||
DebugAdapterName(Self::ADAPTER_NAME.into())
|
||||
}
|
||||
|
||||
fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
async fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
let mut args = json!({
|
||||
"type": "pwa-node",
|
||||
"request": match zed_scenario.request {
|
||||
|
|
|
@ -102,7 +102,8 @@ impl PhpDebugAdapter {
|
|||
envs: HashMap::default(),
|
||||
request_args: StartDebuggingRequestArguments {
|
||||
configuration,
|
||||
request: <Self as DebugAdapter>::request_kind(self, &task_definition.config)?,
|
||||
request: <Self as DebugAdapter>::request_kind(self, &task_definition.config)
|
||||
.await?,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -290,11 +291,14 @@ impl DebugAdapter for PhpDebugAdapter {
|
|||
Some(SharedString::new_static("PHP").into())
|
||||
}
|
||||
|
||||
fn request_kind(&self, _: &serde_json::Value) -> Result<StartDebuggingRequestArgumentsRequest> {
|
||||
async fn request_kind(
|
||||
&self,
|
||||
_: &serde_json::Value,
|
||||
) -> Result<StartDebuggingRequestArgumentsRequest> {
|
||||
Ok(StartDebuggingRequestArgumentsRequest::Launch)
|
||||
}
|
||||
|
||||
fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
async fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
let obj = match &zed_scenario.request {
|
||||
dap::DebugRequest::Attach(_) => {
|
||||
bail!("Php adapter doesn't support attaching")
|
||||
|
|
|
@ -81,12 +81,12 @@ impl PythonDebugAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
fn request_args(
|
||||
async fn request_args(
|
||||
&self,
|
||||
delegate: &Arc<dyn DapDelegate>,
|
||||
task_definition: &DebugTaskDefinition,
|
||||
) -> Result<StartDebuggingRequestArguments> {
|
||||
let request = self.request_kind(&task_definition.config)?;
|
||||
let request = self.request_kind(&task_definition.config).await?;
|
||||
|
||||
let mut configuration = task_definition.config.clone();
|
||||
if let Ok(console) = configuration.dot_get_mut("console") {
|
||||
|
@ -202,7 +202,7 @@ impl PythonDebugAdapter {
|
|||
}),
|
||||
cwd: Some(delegate.worktree_root_path().to_path_buf()),
|
||||
envs: HashMap::default(),
|
||||
request_args: self.request_args(delegate, config)?,
|
||||
request_args: self.request_args(delegate, config).await?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ impl DebugAdapter for PythonDebugAdapter {
|
|||
Some(SharedString::new_static("Python").into())
|
||||
}
|
||||
|
||||
fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
async fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
let mut args = json!({
|
||||
"request": match zed_scenario.request {
|
||||
DebugRequest::Launch(_) => "launch",
|
||||
|
|
|
@ -45,7 +45,10 @@ impl DebugAdapter for RubyDebugAdapter {
|
|||
Some(SharedString::new_static("Ruby").into())
|
||||
}
|
||||
|
||||
fn request_kind(&self, _: &serde_json::Value) -> Result<StartDebuggingRequestArgumentsRequest> {
|
||||
async fn request_kind(
|
||||
&self,
|
||||
_: &serde_json::Value,
|
||||
) -> Result<StartDebuggingRequestArgumentsRequest> {
|
||||
Ok(StartDebuggingRequestArgumentsRequest::Launch)
|
||||
}
|
||||
|
||||
|
@ -83,7 +86,7 @@ impl DebugAdapter for RubyDebugAdapter {
|
|||
})
|
||||
}
|
||||
|
||||
fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
async fn config_from_zed_format(&self, zed_scenario: ZedDebugConfig) -> Result<DebugScenario> {
|
||||
match zed_scenario.request {
|
||||
DebugRequest::Launch(launch) => {
|
||||
let config = RubyDebugConfig {
|
||||
|
@ -196,7 +199,7 @@ impl DebugAdapter for RubyDebugAdapter {
|
|||
),
|
||||
envs: ruby_config.env.into_iter().collect(),
|
||||
request_args: StartDebuggingRequestArguments {
|
||||
request: self.request_kind(&definition.config)?,
|
||||
request: self.request_kind(&definition.config).await?,
|
||||
configuration,
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue