This commit is contained in:
Vulpesx 2024-11-21 21:06:31 -08:00 committed by GitHub
commit c5469a4964
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 6 deletions

View File

@ -380,6 +380,8 @@ pub struct TerminalConfig {
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub args: Vec<String>,
#[serde(default)]
pub join_args: bool,
}
#[cfg(windows)]
@ -413,6 +415,7 @@ pub fn get_terminal_provider() -> Option<TerminalConfig> {
return Some(TerminalConfig {
command: "tmux".to_string(),
args: vec!["split-window".to_string()],
join_args: false,
});
}
@ -420,6 +423,7 @@ pub fn get_terminal_provider() -> Option<TerminalConfig> {
return Some(TerminalConfig {
command: "wezterm".to_string(),
args: vec!["cli".to_string(), "split-pane".to_string()],
join_args: false,
});
}

View File

@ -287,7 +287,7 @@ fn execution_pause_indicator<'doc>(
) -> GutterFn<'doc> {
let style = theme.get("ui.debug.active");
let current_stack_frame = editor.current_stack_frame();
let frame_line = current_stack_frame.map(|frame| frame.line - 1);
let frame_line = current_stack_frame.and_then(|frame| frame.line.checked_sub(1));
let frame_source_path = current_stack_frame.map(|frame| {
frame
.source

View File

@ -366,12 +366,33 @@ pub async fn handle_debugger_message(&mut self, payload: helix_dap::Payload) ->
Some(debugger) => debugger,
None => return false,
};
let mut process = std::process::Command::new(config.command);
let process = match std::process::Command::new(config.command)
.args(config.args)
.arg(arguments.args.join(" "))
.spawn()
{
process
.args(
config
.args
.into_iter()
.map(|s| s.replace("%{cwd}", &arguments.cwd)), // temporary until #11164 is merged
)
.current_dir(arguments.cwd);
if config.join_args {
process.arg(arguments.args.join(" "));
} else {
process.args(arguments.args);
}
if let Some(env) = arguments.env {
for (k, v) in env {
match v {
Some(v) => process.env(k, v),
None => process.env_remove(k),
};
}
}
let process = match process.spawn() {
Ok(process) => process,
Err(err) => {
self.set_error(format!("Error starting external terminal: {}", err));