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

Update the start positions of referenced nodes when editing a syntax tree #18

Closed maxbrunsfeld closed 6 years ago

maxbrunsfeld commented 6 years ago

In this PR, we've moved the syntax tree's cache of nodes from JS into C++. This allows us to use weak references in the cache, so that we'll only maintain pointers to nodes that are retained elsewhere. This way, when we edit the syntax tree, we'll know which syntax nodes we need to update.

🍐'd with @queerviolet

Fixes https://github.com/tree-sitter/node-tree-sitter/issues/17