emacs-devel
[Top][All Lists]
Advanced

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

Re: tree-sitter version?


From: Yuan Fu
Subject: Re: tree-sitter version?
Date: Fri, 25 Nov 2022 01:43:39 -0800


> On Nov 23, 2022, at 9:54 PM, Tassilo Horn <tsdh@gnu.org> wrote:
> 
> Yuan Fu <casouri@gmail.com> writes:
> 
> Hi Yuan,
> 
>>> So: am I supposed to install tree-sitter from github or from debian's
>>> package manager?
>> 
>> Either should be fine.
> 
> Ah, I was wondering the same when I wanted to give tree-sitter a try.  I
> have tree-sitter 0.20.7 installed but the configure output said
> ">=0.20.2 no" but only reported a >= 0.6.x version.  It still works
> fine. :-)
> 
>>> I first did the package-manager version, then pulled from github and
>>> installed that -- configure shows that tree-sitter is detected -- but
>>> calling any of the tree-sitter modes, eg c-ts-mode barfs with an
>>> error saying that support is not available.
>> 
>> If you call tree-sitter-available-p, what do you get? Most likely you
>> don’t have the relevant language definition/grammar for those
>> modes. You can probably find them on package managers, or you can
>> build with the script here:
> 
> Indeed, that was the next trap I fell in.  On Arch, tree-sitter is in
> the community repository (so basically almost official) whereas the
> language definitions are only on the AUR.  Maybe the NEWS entry should
> tell more clearly that tree-sitter needs to be system-installed and also
> the language definitions need to be grabbed somewhere.

Yeah there will be a NEWS entry for tree-sitter.

> 
> BTW, how can a user decide that tree-sitter modes should be used?  For
> example, when I open a json file I get js-json-mode, not json-ts-mode,
> which also works, so support is available.  Should user's augment
> auto-mode-alist?  Or is there some "enable TS whenever possible and the
> devs think its support is in a usable state for that language" toggle?

There is no global toggle, unfortunately. You could use auto-mode-alist or 
major-mode-remap-alist to enable tree-sitter modes, yes. I imagine there could 
be a third-party package that automatically enables tree-sitter for all 
supported nodes, maybe.

Yuan


reply via email to

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