emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree-sitter integration on feature/tree-sitter


From: Yuan Fu
Subject: Re: Tree-sitter integration on feature/tree-sitter
Date: Thu, 16 Jun 2022 12:09:10 -0700


> On May 18, 2022, at 2:07 PM, Theodor Thornhill <theo@thornhill.no> wrote:
> 
>> 
>> Thanks, I think it could be very useful. I can add an option for the
>> user of treesit-traverse-depth-first to control the depth it goes. And
>> same for treesit-traverse-forward-depth-first. A relative depth of 0
>> could mean only traverse siblings and parent, nil means traverse all
>> the way, a positive number n means traverse n steps down.
>> 
> 
> Nice, thanks!

I added a new parameter DEPTH to treesit-traverse-depth-first and 
treesit-traverse-forward-depth-first (renamed to treesit-traverse-forward).

I also realized that the slowness is due to treesit-query-capture, not the 
number of nodes we traversed. So utilizing the DEPTH parameter only has 
semantic advantage. You should compile the query (a new feature I added) and 
use the compiled query for treesit-defun-query. With that, no matter the value 
of DEPTH, jumping to defun begin/end is always fast.

I also added manual entries for traverse functions, please have a look ;-) I 
haven’t add manual for treesit-search and treesit-defun-query, etc yet.

> 
> Also, discovered a typo, and shielded the defuns with a fallback value,
> see provided patch:

Also merged, thanks.

Yuan


reply via email to

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