latex-lsp / tree-sitter-latex

LaTeX grammar for tree-sitter
MIT License
87 stars 21 forks source link

BREAKING: Don't check in generated parser.c file #114

Closed pfoerster closed 3 months ago

clason commented 3 months ago

Note: this is a breaking change for downstream consumers, better mark it as such. This is recommended by upstream, but only in combination with versioned releases (which do contain parser.c so downstream can build parsers without having to require users to install tree-sitter CLI).

And could you please keep grammar.json committed? This is much smaller, has meaningful diffs, and allows faster generation than grammar.js (tree-sitter generate src/grammar.json).

clason commented 3 months ago

Also, consider https://github.com/tree-sitter/workflows; see https://github.com/tree-sitter-grammars/template

clason commented 3 months ago

(Disregard my suggestion about grammar.json; it doesn't seem to make a serious difference for this parser -- it did for other, smaller ones. So there's no big benefit for this parser; it's mostly useful for languages that import other languages, where generating from grammar.js -- but not from grammar.json -- requires npm. I was hoping to be able to unify this in nvim-treesitter to always use tree-sitter generate src/grammar.json, but that is not necessarily a compelling argument for you.)

pfoerster commented 3 months ago

@clason Well, it looks like checking in parser.c still seems to be the recommended way so I guess I'll keep the existing structure for now to avoid the breaking changes downstream.

Also, consider https://github.com/tree-sitter/workflows; see https://github.com/tree-sitter-grammars/template

Thanks, these look very good!

clason commented 3 months ago

@clason Well, it looks like checking in parser.c still seems to be the recommended way so I guess I'll keep the existing structure for now to avoid the breaking changes downstream.

Well, officially the recommended way is

  1. keep parser.c out of the repo;
  2. make frequent semver releases with parser.c.

What's not yet done is adding support to tree-sitter CLI to make 2. easier. So I wouldn't worry too much; now that I know what's happening I can easily adjust in nvim-treesitter (which will also move to preferring releases over YOLO master).