this post was submitted on 18 Nov 2023
3 points (100.0% liked)

Emacs

311 readers
2 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

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!

top 2 comments
sorted by: hot top controversial new old
[–] MotherCanada@alien.top 1 points 11 months ago

I love treesit-auto. It's made using and integrating tree sitter so easy and straightforward. Thanks for an excellent package.

[–] github-alphapapa@alien.top 1 points 11 months ago

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