Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

include generated files #245

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

Merged
aspeddro merged 7 commits into rescript-lang:main from FreddieGilbraith:main
Jun 2, 2024
Merged

Conversation

Copy link
Contributor

@FreddieGilbraith FreddieGilbraith commented Apr 8, 2024

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 :)

endosama and ribru17 reacted with rocket emoji
Copy link
Contributor

ribru17 commented May 21, 2024

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

FreddieGilbraith reacted with thumbs up emoji Emilios1995 reacted with eyes emoji

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 :)

Copy link
Contributor Author

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

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?

ribru17 reacted with thumbs up emoji

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).

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.

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.

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 :)

Emilios1995 and aspeddro reacted with thumbs up emoji

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

aspeddro commented Jun 2, 2024

Thank you @FreddieGilbraith!!!

FreddieGilbraith reacted with heart emoji

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
Reviewers
1 more reviewer

@WhyThat WhyThat WhyThat left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /