Files
kerolox/CONTRIBUTING.md

1.6 KiB

  • TODO: document VSCode extension development practices
  • TODO: document Helix Kerolox language setup
  • TODO: document licensing and attribution guidelines

Contributing to the Tree-sitter Grammar

The Kerolox tooling makes use of a custom tree-sitter grammar for fast incremental parsing.

The tree-sitter grammar lives in the tree-sitter-kerolox directory in the repository. The main file of interest is grammar.js, which defines the actual Kerolox grammar. The tree-sitter documentation has very useful documentation on how to work with this grammar definition.

Any time the grammar is modified, the tree-sitter parser needs to be regenerated using the tree-sitter CLI. Otherwise, the changes to the grammar won't actually be compiled. To regenerate the parser from the grammar, ensure the CLI is installed, and run this command in the tree-sitter-kerolox directory:

tree-sitter generate --abi 14

We use an ABI version of 14 because it's known to work with older versions of Helix, Marceline's preferred text editor. This is a deliberately overly cautious policy, but we're open to changing it if there's a good reason to.

The generated files should be committed and pushed as normal, since it's conventional for third-party tools to pull and compile pregenerated tree-sitter parsers directly from their upstream repositories.