From 4174b25b3d0d39c09a6d4bcd7fa22ee98be52ed1 Mon Sep 17 00:00:00 2001 From: Fisher Darling Date: Thu, 20 Oct 2022 00:17:50 +0200 Subject: Pretty print `tree-sitter-subtree` expression (#4295) --- helix-term/src/commands/typed.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'helix-term/src') diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 1bfc8153..13a0adcf 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1487,7 +1487,9 @@ fn tree_sitter_subtree( .root_node() .descendant_for_byte_range(from, to) { - let contents = format!("```tsq\n{}\n```", selected_node.to_sexp()); + let mut contents = String::from("```tsq\n"); + helix_core::syntax::pretty_print_tree(&mut contents, selected_node)?; + contents.push_str("\n```"); let callback = async move { let call: job::Callback = -- cgit v1.2.3-70-g09d2