aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-22 11:44:16 +0000
committerDmitry Sharshakov2021-08-22 11:44:16 +0000
commit3197c2536ecb0f4f7aa4dfb75ece549b72249541 (patch)
treedbba559627220579fffbd00c45eea9107673eae8 /helix-term/src
parent838f69929db3d9d1e30fa52913a730f2e64b0681 (diff)
Add eval command
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 3449d94b..cc5ce67c 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1910,6 +1910,20 @@ mod cmd {
Ok(())
}
+ fn debug_eval(
+ cx: &mut compositor::Context,
+ args: &[&str],
+ _event: PromptEvent,
+ ) -> anyhow::Result<()> {
+ use helix_lsp::block_on;
+ if let Some(debugger) = cx.editor.debugger.as_mut() {
+ let id = debugger.stack_pointer.clone().map(|x| x.id);
+ let response = block_on(debugger.eval(args.join(" "), id))?;
+ cx.editor.set_status(response.result);
+ }
+ Ok(())
+ }
+
pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
TypableCommand {
name: "quit",
@@ -2148,6 +2162,13 @@ mod cmd {
doc: "Display tree sitter scopes, primarily for theming and development.",
fun: tree_sitter_scopes,
completer: None,
+ },
+ TypableCommand {
+ name: "debug-eval",
+ alias: None,
+ doc: "Evaluate expression in current debug context.",
+ fun: debug_eval,
+ completer: None,
}
];