emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature/tree-sitter ac4cafd66e 1/5: * src/treesit.c (make_ts_parser)


From: Fu Yuan
Subject: Re: feature/tree-sitter ac4cafd66e 1/5: * src/treesit.c (make_ts_parser): Initialize timestamp field.
Date: Tue, 30 Aug 2022 11:14:51 -0700

> Yuan Fu <casouri@gmail.com> writes:
> 
>>    * src/treesit.c (make_ts_parser): Initialize timestamp field.
> 
> Hmm... Out of curiosity, what is this timestamp field used for?

If you retrieve an ast node from the parsed ast tree, then make some edit to 
the buffer and thus change the ast tree, the node you retrieved will be 
outdated. Each parser and node has a timestamp, parser’s timestamp increments 
when an edit is made. Treesit checks if the node’s timestamp equals to that of 
its associated parser whenever we use a node.

Though because parsers are lazy, even if the buffer content has changed, a node 
won’t be marked outdated until the parser parses the change.

Yuan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]