euclidianAce / ltreesitter

Standalone tree sitter bindings for the Lua language
MIT License
85 stars 4 forks source link

Rubbish values from `Node.source` after editing tree #25

Open xcb-xwii opened 11 months ago

xcb-xwii commented 11 months ago

After editing a certain range of the tree using Tree.edit / Tree.edit_s, some calls to Node.source will return rubbish values.

This seems to only apply to nodes that were not affected by the edit. Nodes that did experience changes will return their source text correctly, while unaffected nodes return what I can only assume is junk.

xcb-xwii commented 11 months ago

Read through the code and found this line: https://github.com/euclidianAce/ltreesitter/blob/0c63020d861b6a3cfa5ff9a756a512b3efc533a3/include/ltreesitter/types.h#L31C1-L31C1

The lack of support for a reader function might be the cause instead. The testing during which I encountered this uses a reader function.