Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full :tree-sitter-tree in addition to existing :tree-sitter-subtree #12149

Open
uncenter opened this issue Nov 29, 2024 · 2 comments · May be fixed by #12207
Open

Add full :tree-sitter-tree in addition to existing :tree-sitter-subtree #12149

uncenter opened this issue Nov 29, 2024 · 2 comments · May be fixed by #12207
Labels
C-enhancement Category: Improvements

Comments

@uncenter
Copy link
Contributor

I would love to see a :tree-sitter-tree command that opens a side buffer containing the full document parse tree. This exists in Zed and Neovim:

CleanShot 2024-11-28 at 23 50 46
CleanShot 2024-11-28 at 23 51 46

:tree-sitter-subtree can work in most cases, if you just select the entire document and then run the command. But it is not ergonomic to use; the popup sticks around to where the cursor is, and only stays visible in visual mode - you can't edit the document and still see the tree.

CleanShot 2024-11-28 at 23 54 14

I would try to implement this myself but I'm not sure how to go about programatically creating a new buffer panel to the side with set dimensions and all that. The rest of the code can easily be copied from the existing command source, without the selection-related stuff.

fn tree_sitter_subtree(

@uncenter uncenter added the C-enhancement Category: Improvements label Nov 29, 2024
@NikitaRevenco
Copy link
Contributor

NikitaRevenco commented Dec 6, 2024

Is #12207 good enough?

@NikitaRevenco NikitaRevenco linked a pull request Dec 6, 2024 that will close this issue
@uncenter
Copy link
Contributor Author

uncenter commented Dec 6, 2024

Ooh thank you! Like you mentioned in the PR comment there it would be awesome if it could update when the original buffer changes as well, but as an MVP this is great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants