debugger: Add args argument to debugger launch config (#27953)
This also fixes a bug where debug cargo test code actions would debug all tests in a mod instead of a specific test Release Notes: - N/A
This commit is contained in:
parent
500964a6fa
commit
108ae0b5b0
15 changed files with 42 additions and 17 deletions
|
@ -471,7 +471,6 @@ impl DapStore {
|
|||
initialize_args: config.initialize_args.clone(),
|
||||
tcp_connection: config.tcp_connection.clone(),
|
||||
locator: None,
|
||||
args: Default::default(),
|
||||
stop_on_entry: config.stop_on_entry,
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ impl DapLocator for CargoLocator {
|
|||
};
|
||||
|
||||
let mut child = Command::new("cargo")
|
||||
.args(&debug_config.args)
|
||||
.args(&launch_config.args)
|
||||
.arg("--message-format=json")
|
||||
.current_dir(cwd)
|
||||
.stdout(Stdio::piped())
|
||||
|
@ -59,7 +59,30 @@ impl DapLocator for CargoLocator {
|
|||
};
|
||||
|
||||
launch_config.program = executable;
|
||||
debug_config.args.clear();
|
||||
let mut test_name = None;
|
||||
|
||||
if launch_config
|
||||
.args
|
||||
.first()
|
||||
.map_or(false, |arg| arg == "test")
|
||||
{
|
||||
if let Some(package_index) = launch_config
|
||||
.args
|
||||
.iter()
|
||||
.position(|arg| arg == "-p" || arg == "--package")
|
||||
{
|
||||
test_name = launch_config
|
||||
.args
|
||||
.get(package_index + 2)
|
||||
.filter(|name| !name.starts_with("--"))
|
||||
.cloned();
|
||||
}
|
||||
}
|
||||
|
||||
launch_config.args.clear();
|
||||
if let Some(test_name) = test_name {
|
||||
launch_config.args.push(test_name);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,6 +225,7 @@ impl LocalMode {
|
|||
DebugRequestType::Launch(task::LaunchConfig {
|
||||
program: "".to_owned(),
|
||||
cwd: None,
|
||||
args: Default::default(),
|
||||
})
|
||||
}
|
||||
dap::StartDebuggingRequestArgumentsRequest::Attach => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue