Each language’s behavior for upgrade, fallback, and installation are defined by a recipe in `treesit-auto-recipe-list`. Here is an example entry for JavaScript:
,(make-treesit-auto-recipe
:lang 'typescript
:ts-mode 'typescript-ts-mode
:remap 'typescript-mode
:requires 'tsx
:url "https://github.com/tree-sitter/tree-sitter-typescript"
:revision "master"
:source-dir "typescript/src"
:ext "\\.ts\\'")
:lang
should exactly match the grammar name in the source repository’sgrammar.js
. Look for a line like this:ts-mode
must be a single quoted symbol that is the tree-sitter mode Emacs should use for this grammar:remap
is either a quoted symbol or quoted list of symbols that are modes that should attempt to “switch up” to the tree-sitter major mode. When the tree-sitter grammar isn’t available, these modes are tried in order as fallback modes:requires
optionally specifies a quoted language symbol or quoted list of symbols of any grammars that must be installed alongside this one.:url
must specify the grammar’s source repository. Many are already listed on the tree-sitter GitHub:revision
and:source-dir
are optional, but may be required if thescanner.c
file is not found under the default directory or on the default branch:cc
and:c++
should be left unspecified, as they are reserved for user customization:ext
should be a regexp compatible withauto-mode-alist
, specifying file extensions that would use this tree-sitter mode.
When submitting a pull request for a new recipe, use the title New recipe: <grammar name>
,
and ensure that the patch consists only of the net-new recipe
lines, in the correct alphabetical position within treesit-auto-recipe-list
.