Hi Loris, "Loris Bennett" <[email protected]> writes:
> Hi, > > I am on Debian 13 and am trying to install the Python language grammar for > tree sitter. IIUC there is some ABI issue regarding the installed version of > libtree-sitter (on Debian 13: 0.22.6) and the version of the language grammar > one can install. > > However I have tried multiple versions of the grammar, from the very old to > the most recent and always get the error: > > Warning (treesit): The installed language grammar for python cannot be > located or has problems (version-mismatch): 15 > > What am I doing wrong? > tree-sitter transitioned to ABI 15 since 0.23.x, which explains why you are seeing this issue on Trixie which has 0.22.6 as you've discovered. This would not be an issue if you regenerate everything in the language source code, but Emacs only cares about the generated parser code (usually src/parser.c and src/scanner.c), and if the release you use is generated using a newer tree-sitter you'll see this issue. A simple fix is to find the last release that was generated with tree-sitter on ABI 14. For python, you can add the following to your init.el (I'm using boxquote and you can remove the prefixes using `M-x boxquote-unbox-region'): ,----[ tree-sitter-python for ABI 14 ] | (add-to-list 'treesit-language-source-alist | `((python "https://github.com/tree-sitter/tree-sitter-python" | ,(if (< (treesit-library-abi-version) 15) | "v0.23.6" | "master")))) `---- Hopefully we'll have some tree-sitter grammars shipped in Forky so that users can use the *-ts-mode without such hassle. P.S. For people using treesit-auto, I've been using a treesit-language-source-alist setting that should work with Trixie for most of the incompatible grammars that it supports. Hope this is useful. Note: I have to fork some of the repos as Emacs doesn't seem to support checking out a specific commit and I need to create a branch for it to work. Also tree-sitter-latex doesn't ship src/parser.c at all so I just regenerated the source code manually. If you know of a better way to handle these do let me know :) ,----[ treesit-auto compatible settings for ABI 14 ] | (setq treesit-language-source-alist | `((bash "https://github.com/tree-sitter/tree-sitter-bash" | ,(if (< (treesit-library-abi-version) 15) | "v0.21.0" | "master")) | (bibtex "https://github.com/manphiz/tree-sitter-bibtex" | ,(if (< (treesit-library-abi-version) 15) | "last-abi-14" | "master")) | (c "https://github.com/tree-sitter/tree-sitter-c" | ,(if (< (treesit-library-abi-version) 15) | "v0.23.1" | "master")) | (c-sharp "https://github.com/tree-sitter/tree-sitter-c-sharp" | ,(if (< (treesit-library-abi-version) 15) | "v0.21.3" | "master")) | (css "https://github.com/tree-sitter/tree-sitter-css" | ,(if (< (treesit-library-abi-version) 15) | "v0.21.1" | "master")) | (go "https://github.com/tree-sitter/tree-sitter-go" | ,(if (< (treesit-library-abi-version) 15) | "v0.21.2" | "master")) | (gomod "https://github.com/camdencheek/tree-sitter-go-mod" | ,(if (< (treesit-library-abi-version) 15) | "v1.1.0" | "master")) | (janet "https://github.com/manphiz/tree-sitter-janet" | ,(if (< (treesit-library-abi-version) 15) | "last-abi-14" | "master")) | (javascript "https://github.com/tree-sitter/tree-sitter-javascript" | ,(if (< (treesit-library-abi-version) 15) | "v0.21.4" | "master")) | (julia "https://github.com/tree-sitter/tree-sitter-julia" | ,(if (< (treesit-library-abi-version) 15) | "v0.23.1" | "master")) | (latex "https://github.com/manphiz/tree-sitter-latex" "manual-abi-14") | (lua "https://github.com/tree-sitter-grammars/tree-sitter-lua" | ,(if (< (treesit-library-abi-version) 15) | "v0.3.0" | "master")) | (magik "https://github.com/krn-robin/tree-sitter-magik" | ,(if (< (treesit-library-abi-version) 15) | "0.0.1" | "master")) | (markdown "https://github.com/tree-sitter-grammars/tree-sitter-markdown" | "main") | (nu "https://github.com/manphiz/tree-sitter-nu" | ,(if (< (treesit-library-abi-version) 15) | "last-abi-14" | "master")) | (perl "https://github.com/ganezdragon/tree-sitter-perl" | ,(if (< (treesit-library-abi-version) 15) | "v1.1.1" | "master")) | (python "https://github.com/tree-sitter/tree-sitter-python" | ,(if (< (treesit-library-abi-version) 15) | "v0.23.6" | "master")) | (rust "https://github.com/tree-sitter/tree-sitter-rust" | ,(if (< (treesit-library-abi-version) 15) | "v0.23.3" | "master")) | (sql "https://github.com/manphiz/tree-sitter-sql" | ,(if (< (treesit-library-abi-version) 15) | "last-abi-14" | "gh-pages")) | (vue "https://github.com/manphiz/tree-sitter-vue" | ,(if (< (treesit-library-abi-version) 15) | "last-abi-14" | "master")) | (yaml "https://github.com/tree-sitter-grammars/tree-sitter-yaml" | ,(if (< (treesit-library-abi-version) 15) | "v0.7.2" | "master")))) `---- > Cheers, > > Loris -- Regards, Xiyue Deng
signature.asc
Description: PGP signature

