Skip to content

Commit 908c626

Browse files
jrvidalShekhinah Memmel
authored and
Shekhinah Memmel
committed
display tree sitter scopes in a popup (helix-editor#4337)
1 parent e477918 commit 908c626

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

helix-term/src/commands/typed.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,21 @@ fn tree_sitter_scopes(
10601060

10611061
let pos = doc.selection(view.id).primary().cursor(text);
10621062
let scopes = indent::get_scopes(doc.syntax(), text, pos);
1063-
cx.editor.set_status(format!("scopes: {:?}", &scopes));
1063+
1064+
let contents = format!("```json\n{:?}\n````", scopes);
1065+
1066+
let callback = async move {
1067+
let call: job::Callback =
1068+
Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
1069+
let contents = ui::Markdown::new(contents, editor.syn_loader.clone());
1070+
let popup = Popup::new("hover", contents).auto_close(true);
1071+
compositor.replace_or_push("hover", popup);
1072+
});
1073+
Ok(call)
1074+
};
1075+
1076+
cx.jobs.callback(callback);
1077+
10641078
Ok(())
10651079
}
10661080

0 commit comments

Comments
 (0)