emacs-tree-sitter / elisp-tree-sitter

Emacs Lisp bindings for tree-sitter
https://emacs-tree-sitter.github.io
MIT License
816 stars 73 forks source link

Follow mode for tree-sitter-debug-mode #115

Open ag91 opened 3 years ago

ag91 commented 3 years ago

Hi, I am appreciating your mode a lot these days: thank you very much for sharing it! One thing I find amazing is to be able to visualize the syntax tree with tree-sitter-debug-mode. One thing I am missing is to have a follow mode: imagine if navigating the syntax tree highlights the code and viceversa. I think the information should be already there and it's probably a matter of highlighting. Do you have plans for that? And do you have a suggestion what part of the code is worth to look at to make it happen?

Thanks again for emacs-tree-sitter!

ubolonton commented 3 years ago

Thanks for the kind words!

navigating the syntax tree highlights the code and viceversa. I think the information should be already there and it's probably a matter of highlighting. Do you have plans for that?

That's a desirable functionality, but I haven't had time to work on that yet.

And do you have a suggestion what part of the code is worth to look at to make it happen?

The code for tree-sitter-debug is pretty short. It doesn't do much currently. It can be enriched with the inspection APIs. A simple approach would be annotating the debug buffer with text properties. You may also want to check out #23.

ag91 commented 3 years ago

Nice! I will have a look if I manage to hack something decent. By the way, I did not realize you could already add buttons to the debug tree with: (setq tree-sitter-debug-highlight-jump-region 't) and (setq tree-sitter-debug-jump-buttons 't). That already helps!