For local development, there isn't much to prepare:
-
Refer to the README to see how to build from source.
-
Optionally, set up
pre-commit
for the repo:pre-commit install
Its main function is to shorten feedback cycles for issues CI would eventually, but much later, fail on.
-
When adding new snapshot tests, run
insta
likecargo insta test || cargo insta review
to generate and review new and existing snapshots. Use
cargo insta test --unreferenced=delete
to remove any junk snapshots. -
You will need a nightly toolchain available, as some development (but not build) tooling requires it:
- Ensure support for your language exists: search crates.io for
tree-sitter-your-language
. For example, https://crates.io/crates/tree-sitter-python allowssrgn
to support Python. - Come up with queries you would like to see supported for your language. Obvious items
are "all comments" or "strings", which make sense as a baseline and are supported by
virtually all languages. Feel free to go wild. An example for a more involved query
is for Python's
staticmethod
s. These more complex queries are what can makesrgn
more uniquely useful (offer functionality otherwise hardly attainable). The README contains guidance on how get started writing these queries. - Other than that, follow previous work, e.g. the excellent PR at #116 (da2580a85c2101e91889519fcba11e876f865249). It showcases where to add tests, for example.