Skip to content

Latest commit

 

History

History
43 lines (37 loc) · 1.98 KB

CONTRIBUTING.org

File metadata and controls

43 lines (37 loc) · 1.98 KB

Contributing new recipes

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\\'")
  1. :lang should exactly match the grammar name in the source repository’s grammar.js. Look for a line like this
  2. :ts-mode must be a single quoted symbol that is the tree-sitter mode Emacs should use for this grammar
  3. :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
  4. :requires optionally specifies a quoted language symbol or quoted list of symbols of any grammars that must be installed alongside this one.
  5. :url must specify the grammar’s source repository. Many are already listed on the tree-sitter GitHub
  6. :revision and :source-dir are optional, but may be required if the scanner.c file is not found under the default directory or on the default branch
  7. :cc and :c++ should be left unspecified, as they are reserved for user customization
  8. :ext should be a regexp compatible with auto-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.