Aside from new language sources that the community can contribute at any time, this package feels more or less feature complete now.

v1.0.0 on GitHub

For those who don’t know, treesit-auto enables automatic detection, installation, and usage of tree-sitter grammars and modes in Emacs 29+. Vanilla Emacs exposes some variables and functions that facilitate this behavior, but without treesit-auto it’s up to you to check when tree-sitter is available and configure how Emacs behaves when it is (or isn’t). This package takes that work away from you and is designed to fit what the vast majority of users would expect from automatic use of tree-sitter in Emacs.

This started out as just my own configuration to treesit-language-source-alist, major-mode-remap-alist, and auto-mode-alist, but now has a lot of features that didn’t exist just under a year ago when I first announced it.

  1. Automatic detection and installation for built-in tree-sitter modes, such as rust-ts-mode, yaml-ts-mode, toml-ts-mode, typescript-ts-mode, and go-ts-mode. You can get this behavior through the treesit-auto-add-to-auto-mode-alist function (the name is too long…I know)
  2. Less buggy behavior overall, such as ensuring we switch to the tree-sitter mode after installing it
  3. Detecting and installing grammars required by the current mode, such as TypeScript and TSX requiring each other

This package isn’t perfect. It’s honestly still a bit of a hack, and many parts of the code are too clever for my own liking. It does its job, though, and I’ve been a happy, daily user of it for the last 9 months or so. Of course, a big thank you to all who have supported the project and contributed to it along the way!

  • github-alphapapaB
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 months ago

    This sounds very useful. Can it or its functionality be upstreamed?