Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include generated files #245

Merged
merged 7 commits into from
Jun 2, 2024
Merged

Conversation

FreddieGilbraith
Copy link
Contributor

Some projects require the generated files to be present in a tree-sitter repository to use them. Noteably the helix editor is currently refferencing a fork of this grammar and therefore can not be updated to the newest version.

Please can we include the built files in the repo.

I've not included a Github Actions check to ensure the generated files are up-to-date, but am happy to add one if you'd like.

Thanks :)

@KidkArolis KidkArolis mentioned this pull request Apr 15, 2024
@ribru17
Copy link
Contributor

ribru17 commented May 21, 2024

nvim-treesitter would also like this to get merged! :)

Copy link
Contributor

@WhyThat WhyThat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello thanks for this PR should be very usefull :)

binding.gyp Outdated Show resolved Hide resolved
@FreddieGilbraith
Copy link
Contributor Author

I didn't want to add 94bdab2, but without it corepack was installing yarn v4

@Emilios1995
Copy link
Contributor

Our motivation for keeping generated files out of the repo is aligned with this explanation from the swift parser's maintainer.

Neovim doesn't need generated files at all; it can generate them itself. Please look at the installation instructions on the readme.

Regarding helix, I personally much prefer what the Swift parser did, which is to have a branch that is automatically updated with the generated files whenever the main branch changes. (via a GH action.)

Is anyone interested in implementing copying that here?

@clason
Copy link

clason commented May 27, 2024

Neovim doesn't need generated files at all; it can generate them itself.

Well, that's not strictly true. The nvim-treesitter plugin can call tree-sitter to generate the parser before compiling it, but only if the user has the tree-sitter CLI installed (which is not a hard requirement since the vast majority of grammars do commit the parser).

And it is true that upstream recommends not committing the parser iff you make versioned releases which do contain all generated files. I (and upstream) strongly recommend against having a separate branch for that; that just creates confusion and additional work. (The swift parser is not a good model to follow in general; they have very specific needs and workflows.)

Even if you don't keep the parser in the repo, though, you should update and fix the files you do track (bindings, headers, an in particular the scanner includes).

@Emilios1995
Copy link
Contributor

Ok so we'll probably merge this, but we would like a GH action to ensure generated files are up to date. @aspeddro Pointed me to this example on the rescript-core repo. @FreddieGilbraith I'd like to take you up on your offer of adding the action, if you're still interested.

Just one question: Is it necessary to include the bindings? AFACT from looking at @ribru17's PR in nvim-treesitter, neovim doesn't need them. Is that the case for Helix too?

If not, we can generate the files with --no-bindings and end up with smaller diffs.

@clason
Copy link

clason commented May 30, 2024

nvim-treesitter needs no bindings (Helix might need the Rust ones, I don't know), but these of course are not the only consumers. I can't speak for any of them, though.

@FreddieGilbraith
Copy link
Contributor Author

I've added a CI check, and a git hook script to make sure generation is as part of commits.

Looks like no one needs the bindings, helix seems to work without them :)

@aspeddro aspeddro merged commit 5e2a44a into rescript-lang:main Jun 2, 2024
1 check passed
@aspeddro
Copy link
Collaborator

aspeddro commented Jun 2, 2024

Thank you @FreddieGilbraith!!!

purarue added a commit to purarue/tree-sitter-rifleconfig that referenced this pull request Jun 10, 2024
per the discussion here:
rescript-lang/tree-sitter-rescript#245

it looks like its generally not needed, the only thing
needed is the src/ output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants