debugger: Fix panic when handling invalid RunInTerminal
request (#32500)
The new dap-types version has a default to cwd for the RunInTerminalRequest Closes #31695 Release Notes: - debugger beta: Fix panic that occurred when a debug adapter sent an invalid `RunInTerminal` request
This commit is contained in:
parent
9c513223c4
commit
5eb68f0ea4
3 changed files with 36 additions and 5 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4050,7 +4050,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "dap-types"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/zed-industries/dap-types?rev=68516de327fa1be15214133a0a2e52a12982ce75#68516de327fa1be15214133a0a2e52a12982ce75"
|
||||
source = "git+https://github.com/zed-industries/dap-types?rev=cef124a5109d6fd44a3f986882d78ce40b8d4fb5#cef124a5109d6fd44a3f986882d78ce40b8d4fb5"
|
||||
dependencies = [
|
||||
"schemars",
|
||||
"serde",
|
||||
|
|
|
@ -435,7 +435,7 @@ core-foundation-sys = "0.8.6"
|
|||
core-video = { version = "0.4.3", features = ["metal"] }
|
||||
criterion = { version = "0.5", features = ["html_reports"] }
|
||||
ctor = "0.4.0"
|
||||
dap-types = { git = "https://github.com/zed-industries/dap-types", rev = "68516de327fa1be15214133a0a2e52a12982ce75" }
|
||||
dap-types = { git = "https://github.com/zed-industries/dap-types", rev = "cef124a5109d6fd44a3f986882d78ce40b8d4fb5" }
|
||||
dashmap = "6.0"
|
||||
derive_more = "0.99.17"
|
||||
dirs = "4.0"
|
||||
|
|
|
@ -1008,10 +1008,41 @@ impl Session {
|
|||
request: dap::messages::Request,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Task<Result<()>> {
|
||||
let request_args = serde_json::from_value::<RunInTerminalRequestArguments>(
|
||||
let request_args = match serde_json::from_value::<RunInTerminalRequestArguments>(
|
||||
request.arguments.unwrap_or_default(),
|
||||
)
|
||||
.expect("To parse StartDebuggingRequestArguments");
|
||||
) {
|
||||
Ok(args) => args,
|
||||
Err(error) => {
|
||||
return cx.spawn(async move |session, cx| {
|
||||
let error = serde_json::to_value(dap::ErrorResponse {
|
||||
error: Some(dap::Message {
|
||||
id: request.seq,
|
||||
format: error.to_string(),
|
||||
variables: None,
|
||||
send_telemetry: None,
|
||||
show_user: None,
|
||||
url: None,
|
||||
url_label: None,
|
||||
}),
|
||||
})
|
||||
.ok();
|
||||
|
||||
session
|
||||
.update(cx, |this, cx| {
|
||||
this.respond_to_client(
|
||||
request.seq,
|
||||
false,
|
||||
StartDebugging::COMMAND.to_string(),
|
||||
error,
|
||||
cx,
|
||||
)
|
||||
})?
|
||||
.await?;
|
||||
|
||||
Err(anyhow!("Failed to parse RunInTerminalRequestArguments"))
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let seq = request.seq;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue