Skip to content

Conversation

@florianpircher
Copy link

This makes it easier to build the project as a Swift package.

This makes it easer to build the project as a Swift package.
@wetneb
Copy link

wetneb commented Nov 17, 2025

Bindings get re-generated from scratch quite often in repos of tree-sitter parsers, so if this sort of change makes a difference for you, it might be frustrating to ensure it stays in place (especially if you care about multiple repos).
I know nothing about Swift, so I can't judge to what extent it's worth it.

The more future-proof way of doing that would be to make the change in the tree-sitter CLI itself (so that the bindings generation already produces the output you need), but I'm not sure to what extent there is appetite for it… I've been adding more build-time checks myself for queries: tree-sitter/tree-sitter#4955

@florianpircher
Copy link
Author

florianpircher commented Nov 17, 2025

I suspected as much, but this fix solves the issue at least for now.

I have a project that uses about a dozen Tree-sitter packages and the only ones causing issues are the ones that have a scanner and use a dynamic check to include the scanner in the source files of the Swift package. There are many packages that have a scanner file and include it in the Package.swift file (tree-sitter-bash, tree-sitter-html, …) like I do here in this PR, with no dynamic checking, and they work fine.

If that not to your taste, feel free to close this and I’ll use my fork for now and investigate improving the CLI.

@wetneb
Copy link

wetneb commented Nov 17, 2025

I'm not a maintainer here, but I recommend to just use your fork because grammar repos in this github org tend not to be actively maintained anyway.

@florianpircher
Copy link
Author

OK, thanks for the heads-up. I’ll leave this open in cases someone wants to merge it.

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.

2 participants