Skip to content

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

Open
@uncenter

Description

@uncenter

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(

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions