From 6bb4b5fa64964556d4f4843db5fe652e22948be7 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Fri, 30 May 2025 14:32:59 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"debugger=20beta:=20Fix=20bug=20where?= =?UTF-8?q?=20debug=20Rust=20main=20running=20action=20f=E2=80=A6=20(#3174?= =?UTF-8?q?3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …ailed (#31291)" This reverts commit aab76208b53334b85429486c7abd6f0bfcf58dc9. Closes #31737 I cannot repro the original issue that this commit was trying to solve anymore. Release Notes: - N/A --- crates/debugger_ui/src/session/running.rs | 9 +++-- crates/task/src/task_template.rs | 41 +---------------------- 2 files changed, 8 insertions(+), 42 deletions(-) diff --git a/crates/debugger_ui/src/session/running.rs b/crates/debugger_ui/src/session/running.rs index 3998abaa04..331961e089 100644 --- a/crates/debugger_ui/src/session/running.rs +++ b/crates/debugger_ui/src/session/running.rs @@ -874,7 +874,6 @@ impl RunningState { args, ..task.resolved.clone() }; - let terminal = project .update_in(cx, |project, window, cx| { project.create_terminal( @@ -919,6 +918,12 @@ impl RunningState { }; if config_is_valid { + // Ok(DebugTaskDefinition { + // label, + // adapter: DebugAdapterName(adapter), + // config, + // tcp_connection, + // }) } else if let Some((task, locator_name)) = build_output { let locator_name = locator_name.context("Could not find a valid locator for a build task")?; @@ -937,7 +942,7 @@ impl RunningState { let scenario = dap_registry .adapter(&adapter) - .context(format!("{}: is not a valid adapter name", &adapter)) + .ok_or_else(|| anyhow!("{}: is not a valid adapter name", &adapter)) .map(|adapter| adapter.config_from_zed_format(zed_config))??; config = scenario.config; Self::substitute_variables_in_config(&mut config, &task_context); diff --git a/crates/task/src/task_template.rs b/crates/task/src/task_template.rs index 621fcda667..02310bb1b0 100644 --- a/crates/task/src/task_template.rs +++ b/crates/task/src/task_template.rs @@ -237,18 +237,6 @@ impl TaskTemplate { env }; - // We filter out env variables here that aren't set so we don't have extra white space in args - let args = self - .args - .iter() - .filter(|arg| { - arg.starts_with('$') - .then(|| env.get(&arg[1..]).is_some_and(|arg| !arg.trim().is_empty())) - .unwrap_or(true) - }) - .cloned() - .collect(); - Some(ResolvedTask { id: id.clone(), substituted_variables, @@ -268,7 +256,7 @@ impl TaskTemplate { }, ), command, - args, + args: self.args.clone(), env, use_new_terminal: self.use_new_terminal, allow_concurrent_runs: self.allow_concurrent_runs, @@ -715,7 +703,6 @@ mod tests { label: "My task".into(), command: "echo".into(), args: vec!["$PATH".into()], - env: HashMap::from_iter([("PATH".to_owned(), "non-empty".to_owned())]), ..TaskTemplate::default() }; let resolved_task = task @@ -728,32 +715,6 @@ mod tests { assert_eq!(resolved.args, task.args); } - #[test] - fn test_empty_env_variables_excluded_from_args() { - let task = TaskTemplate { - label: "My task".into(), - command: "echo".into(), - args: vec![ - "$EMPTY_VAR".into(), - "hello".into(), - "$WHITESPACE_VAR".into(), - "$UNDEFINED_VAR".into(), - "$WORLD".into(), - ], - env: HashMap::from_iter([ - ("EMPTY_VAR".to_owned(), "".to_owned()), - ("WHITESPACE_VAR".to_owned(), " ".to_owned()), - ("WORLD".to_owned(), "non-empty".to_owned()), - ]), - ..TaskTemplate::default() - }; - let resolved_task = task - .resolve_task(TEST_ID_BASE, &TaskContext::default()) - .unwrap(); - let resolved = resolved_task.resolved; - assert_eq!(resolved.args, vec!["hello", "$WORLD"]); - } - #[test] fn test_errors_on_missing_zed_variable() { let task = TaskTemplate {