tree-sitter / py-tree-sitter

Python bindings to the Tree-sitter parsing library

Home Page:https://tree-sitter.github.io/py-tree-sitter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to sync node after code edit?

zch-cc opened this issue · comments

Hi, first of all thanks for making tree sitter.
I have a question for how to sync node after code edit?
After the code edit, the orginal node.text return None. Is there an api to let the node keep sync and return the full text? The use case is I want to cache all function node in the current file(update every three seconds) and want to use node.text in the subsequence processing. Is there a good way to implement this kind of feature?
I saw the issue #85 is closed because of pr #150 but I am still confuse how to use it. Do I do node.edit for each node that are affected by the update?

Node.edit syncs them