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.
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.
- Install cask.
- Install
npm
. (Some grammars depend on another npm-packaged grammar. For example:cpp
,typescript
.) - Install tree-sitter CLI tool (if you don’t use NodeJS, you can download the binary directly from GitHub).
- Clone this repository and install its dependencies.
git clone https://github.com/ubolonton/tree-sitter-langs
cd tree-sitter-langs
cask install
cask eval "(progn (require 'tree-sitter-langs-build) (tree-sitter-langs-compile 'rust))"
cask eval "(progn (require 'tree-sitter-langs-build) (tree-sitter-langs-create-bundle))"