debugger: Fix issues with launch.json handling (#32563)
After this PR we can run all the in-tree launch.json examples from [this repo](https://github.com/microsoft/vscode-recipes). Things done: - Fill in default cwd at a lower level for all adapters - Update launch.json parsing for DebugScenario changes - Imitate how VS Code normalizes the `type` field for JS debug tasks - Make version field optional - Extend the variable replacer a bit Release Notes: - Debugger Beta: fixed issues preventing loading and running of debug tasks from VS Code's launch.json. --------- Co-authored-by: Anthony Eid <hello@anthonyeid.me> Co-authored-by: Anthony <anthony@zed.dev> Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
0e0ac9b846
commit
c4277681d1
8 changed files with 111 additions and 44 deletions
|
@ -21,18 +21,21 @@ impl CodeLldbDebugAdapter {
|
|||
|
||||
fn request_args(
|
||||
&self,
|
||||
delegate: &Arc<dyn DapDelegate>,
|
||||
task_definition: &DebugTaskDefinition,
|
||||
) -> Result<dap::StartDebuggingRequestArguments> {
|
||||
// CodeLLDB uses `name` for a terminal label.
|
||||
let mut configuration = task_definition.config.clone();
|
||||
|
||||
configuration
|
||||
let obj = configuration
|
||||
.as_object_mut()
|
||||
.context("CodeLLDB is not a valid json object")?
|
||||
.insert(
|
||||
"name".into(),
|
||||
Value::String(String::from(task_definition.label.as_ref())),
|
||||
);
|
||||
.context("CodeLLDB is not a valid json object")?;
|
||||
|
||||
obj.entry("name")
|
||||
.or_insert(Value::String(String::from(task_definition.label.as_ref())));
|
||||
|
||||
obj.entry("cwd")
|
||||
.or_insert(delegate.worktree_root_path().to_string_lossy().into());
|
||||
|
||||
let request = self.request_kind(&configuration)?;
|
||||
|
||||
|
@ -365,7 +368,7 @@ impl DebugAdapter for CodeLldbDebugAdapter {
|
|||
"--settings".into(),
|
||||
json!({"sourceLanguages": ["cpp", "rust"]}).to_string(),
|
||||
],
|
||||
request_args: self.request_args(&config)?,
|
||||
request_args: self.request_args(delegate, &config)?,
|
||||
envs: HashMap::default(),
|
||||
connection: None,
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue