emacs-devel
[Top][All Lists]
Advanced

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

tree-sitter: proper use of parser-set-included-ranges


From: JD Smith
Subject: tree-sitter: proper use of parser-set-included-ranges
Date: Wed, 23 Aug 2023 09:58:14 -0400

`treesit-parser-set-included-ranges’ appears quite useful for directing tree-sitter’s attention to part of a buffer, for example input at a comint mode’s prompt.  But I have noticed that once the included range is set, it remains fixed within the buffer, and does not expand as text is added or removed from that region.  

Since tree-sitter incrementally updates the syntax tree as edits occur, I wonder what the “right time” to update the included region with `set-included-ranges’ is?  Constantly, say in an after-change-function, or “just-in-time”, as you are about to query the syntax tree for some purpose? 

Put another way, does the syntax tree in tree-sitter survive changes to an included range (treating it as an “incremental update”)?  Or does explicitly changing the range effectively dump the tree and rebuild it?


reply via email to

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