tree-sitter / node-tree-sitter

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

Docs? #210

Open WillsterJohnson opened 2 months ago

WillsterJohnson commented 2 months ago

It's quite unclear what behaviours which methods have and under which circumstances.

For example, I've just used cursor.gotoFirstChildForIndex(2), and it has set the new cursor.currentNode to what was previously at cursor.currentNode.children[0]. What was the point of passing 2? Have I misinterpreted this, and it isn't a method for 'go to the Nth child of the current node'?

It would also be useful to update the types to reflect what is actually returned on the various objects. For example, Parser.SyntaxNode.fields exists at runtime, but is missing from the types. If it's deprecated that's fine, but it should at least be present and marked @deprecated rather than being a weird discovery at runtime while debugging a compiler.

Really just need a few basic pointers regarding what thing are/do, even if it's just a line of JSDoc on each of the interface members. I can't find any documentation for this package.