tree-sitter / node-tree-sitter

Node.js bindings for tree-sitter
https://www.npmjs.com/package/tree-sitter
MIT License
649 stars 114 forks source link

Add support for ts_tree_cursor_current_node #31

Closed wingrunr21 closed 5 years ago

wingrunr21 commented 6 years ago

Hey,

What are your thoughts on exposing ts_tree_cursor_current_node as a getter on TreeCursor?

maxbrunsfeld commented 6 years ago

Yes, this would definitely make sense; I just hadn't needed it so far.

wingrunr21 commented 6 years ago

Ok cool. We'd also have the ability to remove the 6 accessor methods (start/end position, start/end index, type, name) since the current node can be returned as a SyntaxNode which already has those methods. The TreeCursor prototype could just proxy to those.

maxbrunsfeld commented 6 years ago

I think for performance I want to keep using those methods directly, since they are called a lot in atoms syntax highlighting code path.