debugger: Fix the JavaScript debug terminal scenario (#33924)

There were a couple of things preventing this from working:

- our hack to stop the node REPL from appearing broke in recent versions
of the JS DAP that started passing `--experimental-network-inspection`
by default
- we had lost the ability to create a debug terminal without specifying
a program

This PR fixes those issues. We also fixed environment variables from the
**runInTerminal** request not getting passed to the spawned program.

Release Notes:

- Debugger: Fix RunInTerminal not working for JavaScript debugger.

---------

Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Remco Smits 2025-07-06 01:48:55 +02:00 committed by GitHub
parent 66e45818af
commit 01295aa687
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 108 additions and 73 deletions

View file

@ -119,7 +119,7 @@ impl DapLocator for CargoLocator {
.context("Couldn't get cwd from debug config which is needed for locators")?;
let builder = ShellBuilder::new(true, &build_config.shell).non_interactive();
let (program, args) = builder.build(
"cargo".into(),
Some("cargo".into()),
&build_config
.args
.iter()

View file

@ -568,7 +568,7 @@ async fn test_fallback_to_single_worktree_tasks(cx: &mut gpui::TestAppContext) {
.into_iter()
.map(|(source_kind, task)| {
let resolved = task.resolved;
(source_kind, resolved.command)
(source_kind, resolved.command.unwrap())
})
.collect::<Vec<_>>(),
vec![(

View file

@ -149,7 +149,7 @@ impl Project {
let settings = self.terminal_settings(&path, cx).clone();
let builder = ShellBuilder::new(ssh_details.is_none(), &settings.shell).non_interactive();
let (command, args) = builder.build(command, &Vec::new());
let (command, args) = builder.build(Some(command), &Vec::new());
let mut env = self
.environment
@ -297,7 +297,10 @@ impl Project {
.or_insert_with(|| "xterm-256color".to_string());
let (program, args) = wrap_for_ssh(
&ssh_command,
Some((&spawn_task.command, &spawn_task.args)),
spawn_task
.command
.as_ref()
.map(|command| (command, &spawn_task.args)),
path.as_deref(),
env,
python_venv_directory.as_deref(),
@ -317,14 +320,16 @@ impl Project {
add_environment_path(&mut env, &venv_path.join("bin")).log_err();
}
(
task_state,
let shell = if let Some(program) = spawn_task.command {
Shell::WithArguments {
program: spawn_task.command,
program,
args: spawn_task.args,
title_override: None,
},
)
}
} else {
Shell::System
};
(task_state, shell)
}
}
}