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
Make it clear in cursor-related doc that they are scoped to the starting node #567
Comments
Yeah, this is actually the expected behavior. The cursor only "walks" within the node that it started from, and it can't go outside of it. This is possible to change, but it would add some complexity. Maybe it's worth it though, because this has confused people before. |
Oh, it makes sense now. Maybe we can update the doc to clear up the confusion? My current use case is getting the "path" from the root node to a given node, to restore cursor position after code formatting: emacs-tree-sitter/elisp-tree-sitter#28. Would |
I think you could use But |
Thanks! |
I've encountered the same issue yesterday. Maybe we should make it clear in the document to end the confusion. See #1485 |
There seems to be a bug with
ts_tree_cursor_goto_parent
when the cursor is initialized on a non-root node.I got it in the Emacs Lisp binding, but can reproduce it with the NodeJS binding (0.16.0):
The text was updated successfully, but these errors were encountered: