emacs-devel
[Top][All Lists]
Advanced

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

Re: How to tell tree-sitter to look for libtree-sitter-go-mod.so instead


From: BTuin
Subject: Re: How to tell tree-sitter to look for libtree-sitter-go-mod.so instead of libtree-sitter-gomod.so?
Date: Tue, 26 Sep 2023 10:30:31 +0200
User-agent: Mozilla Thunderbird

Le 26/09/2023 à 09:58, Pankaj Jangid a écrit :
I am on emacs-29 branch.

I have following settings for go in the ~/.emacs.d/init.el,

#+begin_src elisp
   (setq treesit-language-source-alist
        '((go . ("https://github.com/tree-sitter/tree-sitter-go.git";))
          (go-mod . ("https://github.com/camdencheek/tree-sitter-gomod.git";))))
   (add-to-list 'auto-mode-alist
               `("\\.go\\'" . go-ts-mode))
   (add-to-list 'auto-mode-alist
               `("\\go.mod\\'" . go-mod-ts-mode))
#+end_src

whenever I load .go or go.mod files, I get this error,

--8<---------------cut here---------------start------------->8---
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for 
gomod is unavailable (not-found): (libtree-sitter-gomod libtree-sitter-gomod.0 
libtree-sitter-gomod.0.0 libtree-sitter-gomod.so libtree-sitter-gomod.so.0 
libtree-sitter-gomod.so.0.0) No such file or directory
--8<---------------cut here---------------end--------------->8---

Emacs is looking for libtree-sitter-gomod.so, but in fact the library's
name is libtree-sitter-go-mod.so. Where can I tell tree-sitter to look
for the appropriate file.

Or is this a bug?


You need to use the symbol 'gomod' and not 'go-mod' in
treesit-language-source-alist.

Here is your fixed init.el:

#+begin_src emacs-lisp
(setq treesit-language-source-alist
          '((go . ("https://github.com/tree-sitter/tree-sitter-go.git";))
                (gomod . 
("https://github.com/camdencheek/tree-sitter-gomod.git";))))
(add-to-list 'auto-mode-alist
                         `("\\.go\\'" . go-ts-mode))
(add-to-list 'auto-mode-alist
                         `("\\go.mod\\'" . go-mod-ts-mode))
#+end_src





reply via email to

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