diff options
author | Roberto Vidal | 2022-10-18 18:30:00 +0000 |
---|---|---|
committer | GitHub | 2022-10-18 18:30:00 +0000 |
commit | 1f74cf45d45804da8f33e173b26b3ddda82c706b (patch) | |
tree | eef155aa5f0c368b70e3f81b0e79b2099973135e | |
parent | d17ffc47f008821e1b4ab04cd85d019ed8dc6fb9 (diff) |
display tree sitter scopes in a popup (#4337)
-rw-r--r-- | helix-term/src/commands/typed.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 8ab10da4..1bfc8153 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1060,7 +1060,21 @@ fn tree_sitter_scopes( let pos = doc.selection(view.id).primary().cursor(text); let scopes = indent::get_scopes(doc.syntax(), text, pos); - cx.editor.set_status(format!("scopes: {:?}", &scopes)); + + let contents = format!("```json\n{:?}\n````", scopes); + + let callback = async move { + let call: job::Callback = + Box::new(move |editor: &mut Editor, compositor: &mut Compositor| { + let contents = ui::Markdown::new(contents, editor.syn_loader.clone()); + let popup = Popup::new("hover", contents).auto_close(true); + compositor.replace_or_push("hover", popup); + }); + Ok(call) + }; + + cx.jobs.callback(callback); + Ok(()) } |