Skip to content

Language implementor tips

Cedric Halbronn edited this page Sep 8, 2023 · 7 revisions

This page is odds-and-ends notes for new folks implementing a new language or migrating an existing language to treesitter.

  • Sending small PRs is preferred. Make incremental progress.
  • The scope visualizer supports hot reloading.
  • Make good use of data/playground. Don't be shy about it. It'll help other folks in the future.
  • In a PR description, [x] means "done", [ ] means "not done yet", and [/] means "N/A (not applicable)"
  • Attending meetups is strongly recommended. It's a great place to get questions about behavior answered.
  • In a map/list, "take item comma" takes the items on both sides of the comma. Surprising, but intentional.
  • In maps/lists, the curly braces are not part of the item.
  • Think about comments as you define scopes.
  • Read https://github.com/cursorless-dev/cursorless/issues/1742, as it has useful information
  • Use not just visualize <scope> but also visualize iteration <scope> and visualize removal <scope>
  • The removal range is defined as a series of fallbacks: .removal if it exists (rare), .trailing if non-empty, .leading if non-empty, then just the content range itself.
  • The treesitter query language only supports three captures for any given matched node. After that it silently ignores any captures you write! To work around this, you can duplicate the query.
Clone this wiki locally