I installed from elpa/melpa: ls -1 -d tree-sitter-* tree-sitter-20220212.1632/ tree-sitter-langs-20221122.645/ 21:18:06 elpa $ but emacs compiled from latest Git Head still produces the completely unhelpful message tree-support for language <x> is unavailable if I invoke c-ts-mode or c++-ts-mode A note in the News file detailing what bits one needs to install might be the shoes we need to help us walk the final mile on this long road to tree-sitter integration. -- Thanks, --Raman(I Search, I Find, I Misplace, I Research) ♉ Id: kg:/m/0285kf1 🦮 -- Thanks, --Raman(I Search, I Find, I Misplace, I Research) ♉ Id: kg:/m/0285kf1 🦮 -- Thanks, --Raman(I Search, I Find, I Misplace, I Research) ♉ Id: kg:/m/0285kf1 🦮
> On Nov 24, 2022, at 9:20 PM, T.V Raman <raman@google.com> wrote:
>
> I installed from elpa/melpa:
>
> ls -1 -d tree-sitter-*
> tree-sitter-20220212.1632/
> tree-sitter-langs-20221122.645/
> 21:18:06 elpa $
>
> but emacs compiled from latest Git Head still produces the completely
> unhelpful message
> tree-support for language <x> is unavailable if I invoke c-ts-mode or
> c++-ts-mode
>
> A note in the News file detailing what bits one needs to install might
> be the shoes we need to help us walk the final mile on this long road
> to tree-sitter integration.
We are just starting to work on tree-sitter’s user-facing documentation, including the (emacs) manual and NEWS file. I’ll definitely improve the error message. In the meantime, find files that looks like libtree-sitter-xxx.so and put them under ~/.emacs.d/tree-sitter (or a standard library location like /usr/local/lib), and Emacs should be able to find them.
Yuan
[-- Attachment #1: Type: text/plain, Size: 1744 bytes --] Yuan Fu <casouri@gmail.com> writes: >> On Nov 24, 2022, at 9:20 PM, T.V Raman <raman@google.com> wrote: >> >> I installed from elpa/melpa: >> >> ls -1 -d tree-sitter-* >> tree-sitter-20220212.1632/ >> tree-sitter-langs-20221122.645/ >> 21:18:06 elpa $ >> >> but emacs compiled from latest Git Head still produces the >> completely >> unhelpful message >> tree-support for language <x> is unavailable if I invoke c-ts-mode >> or >> c++-ts-mode >> >> A note in the News file detailing what bits one needs to install >> might >> be the shoes we need to help us walk the final mile on this long >> road >> to tree-sitter integration. > > We are just starting to work on tree-sitter’s user-facing > documentation, including the (emacs) manual and NEWS file. I’ll > definitely improve the error message. In the meantime, find files > that > looks like libtree-sitter-xxx.so and put them under > ~/.emacs.d/tree-sitter (or a standard library location like > /usr/local/lib), and Emacs should be able to find them. > > Yuan Hi Yuan! I have a question. Are these paths hardcoded? I use MacOS, I've built a grammar for java using custom homebrew formula, it produces the file /opt/homebrew/lib/libtree-sitter-java.dylib, but when I open any java source file and try to activate java-ts-mode, I'm getting the error: Warning (treesit): Cannot activate tree-sitter, because language definition for java is unavailable (not-found): (libtree-sitter-java.so libtree-sitter-java.dylib) No such file or directory I can fix it by adding /opt/homebrew/lib to treesit-extra-load-path, but I'm wondering how to install grammar properly to avoid setting this variable. -- Best regards, Roman [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 259 bytes --]
> From: Roman Rudakov <rrudakov@fastmail.com> > Cc: "T.V Raman" <raman@google.com>, emacs-devel@gnu.org > Date: Fri, 25 Nov 2022 11:41:47 +0100 > > > We are just starting to work on tree-sitter’s user-facing > > documentation, including the (emacs) manual and NEWS file. I’ll > > definitely improve the error message. In the meantime, find files > > that > > looks like libtree-sitter-xxx.so and put them under > > ~/.emacs.d/tree-sitter (or a standard library location like > > /usr/local/lib), and Emacs should be able to find them. > > > > Yuan > > Hi Yuan! > > I have a question. Are these paths hardcoded? This is Emacs; how can you assume such hard-coded paths are even possible? Of course, they aren't hard-coded! Emacs looks in the standard directories for shared libraries, then in user-emacs-directory, then in the directories mentioned in treesit-extra-load-path. > I can fix it by adding /opt/homebrew/lib to treesit-extra-load-path, > but I'm wondering how to install grammar properly to avoid setting > this variable. Adding this to treesit-extra-load-path is fine. Alternatively, install the shared library where you have the other shared libraries on your system (a.k.a. "standard places").
> Date: Thu, 24 Nov 2022 21:20:29 -0800
> From: "T.V Raman" <raman@google.com>
>
> I installed from elpa/melpa:
>
> ls -1 -d tree-sitter-*
> tree-sitter-20220212.1632/
> tree-sitter-langs-20221122.645/
> 21:18:06 elpa $
>
> but emacs compiled from latest Git Head still produces the completely
> unhelpful message
> tree-support for language <x> is unavailable if I invoke c-ts-mode or
> c++-ts-mode
The tree-sitter-20220212 package is an external Emacs module, so it is
incompatible with the tree-sitter enabled modes you see on the master
branch. Instead, you should simply install the tree-sitter library using
whatever distro you use to update your system. Or build the tree-sitter
library yourself, from its Git repository, and then install it.
And the tree-sitter-langs-20221122 package requires you to run procedures to
download, compile, and install the language support libraries. Did you run
those procedures? If not, you won't have the language support libraries
where Emacs looks for them.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=gb18030, Size: 446 bytes --] Understood, apologies for having been over-enthusiastic. Incidentally, if one installs tree-sitter-lang from melpa, it automatically builds the modules; but it then requires tree-sitter from Feb 2022 which is older than what is in the emacs tree. We could ease a lot of pain if we brought the language modules into the emacs tree? -- Thanks, --Raman(I Search, I Find, I Misplace, I Research) 7©4 Id: kg:/m/0285kf1 0Ü8
> From: "T.V Raman" <raman@google.com> > Cc: emacs-devel@gnu.org > Date: Fri, 25 Nov 2022 09:57:05 -0800 > > Incidentally, if one installs tree-sitter-lang from melpa, it > automatically builds the modules; but it then requires tree-sitter from > Feb 2022 which is older than what is in the emacs tree. We need a version that supports custom memory-allocation function, because Emacs needs to control how memory is allocated, and what happens when tree-sitter runs out of memory. > We could ease a lot of pain if we brought the language modules into the > emacs tree? That's impractical, and probably won't happen, at least in the near future. Those modules are developed by their own teams, unrelated to Emacs.