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

feature: Node selectDescendants() and buildSelector() feature #585

Closed
cancerberoSgx opened this issue Mar 26, 2019 · 2 comments
Closed

feature: Node selectDescendants() and buildSelector() feature #585

cancerberoSgx opened this issue Mar 26, 2019 · 2 comments

Comments

@cancerberoSgx
Copy link
Contributor

I have a descent implementation for building a node's path from an ancestor and selecting a descendant using the selector. I wonder if you would accept a PR to include this functionality.

Motivation:

  • re-select a node quickly when (it or its ancestors) get forgotten.
  • Have a simple selector query language supporting index, syntax kinds, children , descendants and siblings. Probably no more than just that.
  • be able to verify that ancestors didn't changed (at some configurable degree) although they still are not forgotten

Implementation:

  • optionally collects / validates extra information besides indexes in the path like syntax kind, sibling, children count. The idea is be able to validate that the AST didn't change too much while selecting.
  • supports both ways of obtaining children index (getChildren and forEachChild)
  • the path object is very lightweight and "stringifiable".

Or do you think this is out of topic and users should use tsquery library for this ? Thanks

@dsherret
Copy link
Owner

Hey @cancerberoSgx is this another form of #351? I don't want to add/support any querying in this library at the moment. Someone can build that on top of this library if they'd like (similar to how tsquery is built on top of the typescript compiler api).

@cancerberoSgx
Copy link
Contributor Author

Yes is more or less the same, sorry, The only difference is that I have it implemented now. it's been a while since I work with this library and I forgot about that issue. thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants