Tree-sitter Language Bundle for Emacs
This is a convenient language bundle for the Emacs package tree-sitter. It serves as an interim distribution mechanism, until tree-sitter
is widespread enough for language-specific major modes to incorporate its functionalities.
For each supported language, this package provides:
- Pre-compiled grammar binaries for 3 major platforms: macOS, Linux and Windows, on x86_64. In the future,
tree-sitter-langs
may provide tooling for major modes to do this on their own. - An optional
highlights.scm
file that provides highlighting patterns. This is mainly intended for major modes that are not aware oftree-sitter
. A language major mode that wants to usetree-sitter
for syntax highlighting should instead provide the query patterns on its own, using the mechanisms defined by tree-sitter-hl. - Optional query patterns for other minor modes that provide high-level functionalities on top of
tree-sitter
, such as code folding, evil text objects… As with highlighting patterns, major modes that are directly aware oftree-sitter
should provide the query patterns on their own.
Building grammars from source
It’s more convenient to work with this repository as a submodule of emacs-tree-sitter. However, if you want to skip that, below are the steps to build grammars from source using only this repository.
Tools and dependencies
- Install cask.
- Install NodeJS. It is needed to generate the grammar code from the JavaScript DSL. The recommended tool to manage NodeJS is volta.
- Install tree-sitter CLI tool. (Its binary can also be downloaded directly from GitHub.) Note: versions 0.20+ cannot be used, as they introduce a breaking change in binary storage location.
Building a single grammar
Run script/compile <lang>
, where lang
is one of the languages under repos/.
script/compile rust
Building the whole grammar bundle
script/compile all