debugger beta: Update Javascript's DAP to allow passing in url instead of program (#31494)

Closes #31375

Release Notes:

- debugger beta: Allow passing in URL instead of program for Javascript
launch request
This commit is contained in:
Anthony Eid 2025-05-27 14:02:16 +03:00 committed by GitHub
parent f8f36d0c17
commit 3ff62ef289
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,8 +113,10 @@ impl DebugAdapter for JsDebugAdapter {
) -> Result<dap::StartDebuggingRequestArgumentsRequest> {
match config.get("request") {
Some(val) if val == "launch" => {
if config.get("program").is_none() {
return Err(anyhow!("program is required"));
if config.get("program").is_none() && config.get("url").is_none() {
return Err(anyhow!(
"either program or url is required for launch request"
));
}
Ok(StartDebuggingRequestArgumentsRequest::Launch)
}
@ -143,7 +145,11 @@ impl DebugAdapter for JsDebugAdapter {
map.insert("processId".into(), attach.process_id.into());
}
DebugRequest::Launch(launch) => {
map.insert("program".into(), launch.program.clone().into());
if launch.program.starts_with("http://") {
map.insert("url".into(), launch.program.clone().into());
} else {
map.insert("program".into(), launch.program.clone().into());
}
if !launch.args.is_empty() {
map.insert("args".into(), launch.args.clone().into());
@ -311,7 +317,10 @@ impl DebugAdapter for JsDebugAdapter {
}
}
},
"required": ["program"]
"oneOf": [
{ "required": ["program"] },
{ "required": ["url"] }
]
}
]
},