unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: feature/tree-sitter ac4cafd66e 1/5: * src/treesit.c (make_ts_parser): Initialize timestamp field.
       [not found] ` <20220829184326.E0C61C00890@vcs2.savannah.gnu.org>
@ 2022-08-30  1:24   ` Po Lu
  2022-08-30 18:14     ` Fu Yuan
  0 siblings, 1 reply; 2+ messages in thread
From: Po Lu @ 2022-08-30  1:24 UTC (permalink / raw)
  To: emacs-devel; +Cc: Yuan Fu

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?




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: feature/tree-sitter ac4cafd66e 1/5: * src/treesit.c (make_ts_parser): Initialize timestamp field.
  2022-08-30  1:24   ` feature/tree-sitter ac4cafd66e 1/5: * src/treesit.c (make_ts_parser): Initialize timestamp field Po Lu
@ 2022-08-30 18:14     ` Fu Yuan
  0 siblings, 0 replies; 2+ messages in thread
From: Fu Yuan @ 2022-08-30 18:14 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel


> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-30 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <166179860292.20862.4523485726697982648@vcs2.savannah.gnu.org>
     [not found] ` <20220829184326.E0C61C00890@vcs2.savannah.gnu.org>
2022-08-30  1:24   ` feature/tree-sitter ac4cafd66e 1/5: * src/treesit.c (make_ts_parser): Initialize timestamp field Po Lu
2022-08-30 18:14     ` Fu Yuan

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).