-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Can we find a way to collaborate on tree-sitter support? #16
Comments
So here's a twist I was not expecting! I was inspired by your Package.swift to try out adding SPM support to tree-sitter directly. It's possible! And, so while I was able to open a PR, I found that someone had beat me to it! tree-sitter/tree-sitter#1736 I also experimenting with doing the same thing for parsers. I've tried just a few so far, and while it is more complex, it is also possible! Everything via SPM just seems like a best-case option, so I'm moving SwiftTreeSitter over to that. Just wanted to keep you up to date, since there have been so many developments in the last day or so. |
Thanks for the kind words!
It would be great to find a way to collaborate on bridging Tree-sitter to Swift! Ideally there should be no need for us to maintain two not-so-trivial libraries that solves the same exact problem. So why did I write my own library in the first place then? Here are the main reasons:
Point 3 still stands. I'd like to go far to avoid dependencies but that's not to say that I don't want any, and I think the Tree-sitter bridge may be a good candidate for a dependency. I haven't had a close look at SwiftTreeSitter in a while, so I'm unsure if it would be more or less a drop-in replacement of Runestone's current implementation, or if any changes are needed, or if it in fact makes sense to come up with some alternative.
Yep, Runestone is just wrapping Tree-sitter in a Swift package. I never thought of adding it as a PR to the Tree-sitter repository though. That would be great to have!
That would be amazing! I'd love to know how that goes. I'm far from happy with my current solution for adding parsers to Runestone. |
This all makes total sense. I'm super into small libraries, so that results in more dependencies. But I know that isn't always popular. I'm really happy we're talking about it. But you definitely need to make sure you're building something that makes sense and feels right to you! I was able to get 5 parsers packaged for SPM so far (Go, GoMod, Swift, JSON, and Ruby). The swift parser (perhaps ironically) was the most complex, because it does not check in the generated C code. I haven't yet opened PRs for them, but will this week. I've bundled the queries in the packages too. They don't even depend on the runtime, so they can all be totally independent. It's quite nice! |
First, huge congratulations! This is totally awesome, and shipping is a big deal.
Thanks for the SwiftTreeSitter shout-out in the acknowledgements, that's very kind of you! Do you think we could ever find a way to collaborate in that area? Seems like there's so much overlapping effort here. Perhaps https://github.com/krzyzanowskim/tree-sitter-xcframework might be a starting point?
(If you have interest in sharing why you went your own way on tree-sitter bindings, I'd love to hear. But, everyone's allowed to do their own thing and there's definitely no need justify!)
The text was updated successfully, but these errors were encountered: