Tree-sitter grammar development workflow


Does anyone have any tips for developing tree-sitter grammars?

I was about to ask for actual error assistance, but it seems to have magically fixed itself (though it’ll probably break as soon as I touch it). I frequently get wrong NODE_MODULE_VERSION errors, which are a pain. Working on both the parser and how it runs in Atom at the same time seems impossible.

Should I have different versions of NodeJS installed or something? Am I able to develop the parser locally, and use this local version in the Atom package?

My current workflow is

  1. Make changes to tree-sitter parser and publish to NPM
  2. Delete the old version in node_modules in the Atom grammar package, and run apm install
  3. Hope it works.

There are also frequent bugs in the syntax highlighting. For example,

The comment should not look like a string. (using this tree-sitter grammar and the unpublished GitHub version of this Atom grammar). Having a closing brace there is illegal, and throws a MISSING when I run tree-sitter parse ..., but the syntax highlighting seems to have leaked.

/cc @maxbrunsfeld ?