aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-08-16 09:16:06 +0000
committerBlaž Hrastnik2021-08-20 04:48:32 +0000
commitd39baa3b4e1f5bc1a03533e7b22af0043ec1eac9 (patch)
tree11f769898442e5d4fbddb8aacf2b7ff05fb33cb5 /helix-term
parent0300dbdeb378fa5797a23ce8b3f72e2749c3ce50 (diff)
Start integrating into the editor's event loop
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/Cargo.toml1
-rw-r--r--helix-term/src/application.rs9
-rw-r--r--helix-term/src/commands.rs42
3 files changed, 52 insertions, 0 deletions
diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml
index b42daff6..6ed60e02 100644
--- a/helix-term/Cargo.toml
+++ b/helix-term/Cargo.toml
@@ -24,6 +24,7 @@ path = "src/main.rs"
helix-core = { version = "0.4", path = "../helix-core" }
helix-view = { version = "0.4", path = "../helix-view" }
helix-lsp = { version = "0.4", path = "../helix-lsp" }
+helix-dap = { version = "0.4", path = "../helix-dap" }
anyhow = "1"
once_cell = "1.8"
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 3d59c33a..59072a09 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -245,6 +245,15 @@ impl Application {
}
}
+ pub async fn handle_debugger_message(
+ &mut self,
+ call: (),
+ server_id: usize,
+ ) {
+
+ //
+ }
+
pub async fn handle_language_server_message(
&mut self,
call: helix_lsp::Call,
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index d7d50109..25367520 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1900,6 +1900,41 @@ mod cmd {
Ok(())
}
+ fn debug(
+ cx: &mut compositor::Context,
+ _args: &[&str],
+ _event: PromptEvent,
+ ) -> anyhow::Result<()> {
+ use helix_dap::Client;
+ use helix_lsp::block_on;
+ use serde_json::to_value;
+ let (_, doc) = current!(cx.editor);
+
+ // look up config for filetype
+ // if multiple available, open picker
+
+ log::error!("1");
+
+ let client = Client::tcp_process("dlv", vec!["dap"], "-l 127.0.0.1:{}", 0);
+ let mut client = block_on(client)?;
+ log::error!("2");
+
+ let request = client.initialize("go".to_owned());
+ let _ = block_on(request)?;
+ log::error!("3");
+
+ let mut args = HashMap::new();
+ args.insert("mode", "debug");
+ // args.insert("program", "path/to/program");
+
+ let request = client.launch(to_value(args)?);
+ let _ = block_on(request)?;
+
+ log::error!("4");
+ doc.debugger = Some(client);
+ Ok(())
+ }
+
pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
TypableCommand {
name: "quit",
@@ -2138,6 +2173,13 @@ mod cmd {
doc: "Display tree sitter scopes, primarily for theming and development.",
fun: tree_sitter_scopes,
completer: None,
+ },
+ TypableCommand {
+ name: "debug",
+ alias: None,
+ doc: "Start a debug session.",
+ fun: debug,
+ completer: None,
}
];