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

feat: new :tree-sitter-tree command #12207

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

nik-rev
Copy link
Contributor

@nik-rev nik-rev commented Dec 6, 2024

Using % to select entire file and then using :tree-sitter-subtree which opens in a tiny window makes it difficult to inspect the entire tree.

It would be nice if you could open the current file's entire tree in a separate buffer. Currently this is just a basic implementation, which gets the current file's tree and dumps it into a new buffer. In the future the command can be updated to be more like neovim's :inspect-tree command.

image

Closes #12149

@nik-rev nik-rev changed the title feat: :tree-sitter-tree command feat: new :tree-sitter-tree command Dec 6, 2024
@uncenter
Copy link
Contributor

uncenter commented Dec 6, 2024

For now - as the panel doesn't auto update - would it be possible for subsequent :ts-tree invocations to replace the existing (if it still exists) ts-tree buffer instead of creating a new one?

@nik-rev
Copy link
Contributor Author

nik-rev commented Dec 6, 2024

For now - as the panel doesn't auto update - would it be possible for subsequent :ts-tree invocations to replace the existing (if it still exists) ts-tree buffer instead of creating a new one?

Ok, I just pushed a commit. it will replace the existing buffer now.

@uncenter
Copy link
Contributor

uncenter commented Dec 6, 2024

And is it possible to prevent writing to the syntax tree buffer? Nvim's impl prevents modifying it, and I think especially now that we replace the buffer with a new one we should expect users not to edit it - and enforce that.

@nik-rev
Copy link
Contributor Author

nik-rev commented Dec 6, 2024

And is it possible to prevent writing to the syntax tree buffer? Nvim's impl prevents modifying it, and I think especially now that we replace the buffer with a new one we should expect users not to edit it - and enforce that.

It's not possible to make a file unwritable from what I can tell (readonly will still allow editing, but not saving).

See also this comment by @the-mikedavis : #7128 (comment)

uncenter added a commit to uncenter/helix that referenced this pull request Jan 6, 2025
`patchy` is a tool which makes it easy to declaratively manage personal forks by automatically merging pull requests.

Check it out here: https://github.com/NikitaRevenco/patchy
@nik-rev nik-rev force-pushed the tree-sitter-tree branch 2 times, most recently from ca6940e to 5fff598 Compare January 7, 2025 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add full :tree-sitter-tree in addition to existing :tree-sitter-subtree
3 participants