Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(helix-view): view debug output on windows #2294

Merged
merged 1 commit into from
May 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions helix-view/src/handlers/dap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use helix_core::Selection;
use helix_dap::{self as dap, Client, Payload, Request, ThreadId};
use helix_lsp::block_on;
use log::warn;
use std::io::ErrorKind;
use std::path::PathBuf;

#[macro_export]
Expand Down Expand Up @@ -285,11 +286,31 @@ impl Editor {
serde_json::from_value(request.arguments.unwrap_or_default()).unwrap();
// TODO: no unwrap

let process = std::process::Command::new("tmux")
.arg("split-window")
.arg(arguments.args.join(" "))
.spawn()
.unwrap();
let process = if cfg!(windows) {
std::process::Command::new("wt")
.arg("new-tab")
.arg("--title")
.arg("DEBUG")
.arg("cmd")
.arg("/C")
.arg(arguments.args.join(" "))
.spawn()
.unwrap_or_else(|error| match error.kind() {
ErrorKind::NotFound => std::process::Command::new("conhost")
.arg("cmd")
.arg("/C")
.arg(arguments.args.join(" "))
.spawn()
.unwrap(),
e => panic!("Error to start debug console: {}", e),
})
} else {
std::process::Command::new("tmux")
.arg("split-window")
.arg(arguments.args.join(" "))
.spawn()
.unwrap()
};

let _ = debugger
.reply(
Expand Down