Shopify / tree_stand

A high-level Ruby wrapper for tree-sitter bindings.
https://rubygems.org/gems/tree_stand
MIT License
11 stars 3 forks source link

Improve the hooks provided by the visitor class #24

Closed DerekStride closed 1 year ago

DerekStride commented 1 year ago

What

Adds support for around_* hooks that must yield to continue visiting child nodes. This allows implementing visitors that can stop traversing the tree.

It also allows running callback logic before & after visiting child nodes.

Questions

The new around_* hooks make the on_* hooks unnecessary. Should we remove support for the on_* hooks? It would be a breaking change but we haven't released v1 yet so it could be a good time.

Rendered Documentation Sample

Screenshot 2023-03-30 at 2 42 34 PM
DerekStride commented 1 year ago

I've update the PR according to the feedback: