emacs-devel
[Top][All Lists]
Advanced

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

Re: master 09b5f00613: ; Fix calls to treesit functions


From: Yuan Fu
Subject: Re: master 09b5f00613: ; Fix calls to treesit functions
Date: Mon, 19 Dec 2022 16:12:31 -0800


> On Dec 19, 2022, at 8:42 AM, Theodor Thornhill <theo@thornhill.no> wrote:
> 
> 
> 
> On 19 December 2022 17:13:00 CET, Stefan Monnier <monnier@iro.umontreal.ca> 
> wrote:
>>> The treesit-parser-list is also kind of working just by accident, as
>>> it isn't its job to ensure availability.
>> 
>> No, it's no accident: if Tree-sitter is not available, then indeed the
>> list of Tree-sitter parsers is empty.  So defining that function to return
>> nil when Tree-sitter is not available is a perfectly correct definition.
>> 
>> 
>>       Stefan
>> 
> 
> Yeah, that's not what I meant. I meant that its primary purpose isn't too be 
> used as a guard against treesit not being available at all. I'm fine with 
> using it like this, but seeing how that wasn't enough by itself we should 
> either change it or make a similar function that has that purpose. Fwiw I 
> like your suggestion to make it available without treesit being available.
> 
> Theo
> 

I expect the vast majority uses of tree-sitter involves calling treesit-node-at 
(or treesit-node-on) to get a node, so that seems like a good place to add a 
check. And I’ll make them use (treesit-language-at (point)) by default, so that 
eliminates the need for checking for a particular language. In addition we can 
make treesit-parser-list work regardless of whether tree-sitter is built with 
Emacs. How does that sound?

Yuan


reply via email to

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