alex-pinkus / tree-sitter-swift

A tree-sitter grammar for the Swift programming language.
MIT License
137 stars 34 forks source link

`main` branch can't used directly in `Cargo.toml` as a Rust `git` dependency #377

Closed patrickt closed 6 months ago

patrickt commented 6 months ago

I see that embedding a parser.c in the repo is a well-trod debate, and I certainly don’t want to reopen it. However, the fact that said parser is omitted in the uploaded crate means (AFAICT) that no use of this crate will successfully compile.

I can think of four options as to how to remedy this (and would love to hear others):

  1. Invoke tree-sitter in the build.rs file. While expedient, this would require the tree-sitter CLI to be present on the system.
  2. Provide a configuration option to point at a user-generated parser.c in the build file. This is perhaps the most holistic solution, but requires a bit of explanation in the rustdocs.
  3. Move the crate and all its files into a separate git repo, pull this repo in via a submodule, and embed the parser.c in there. (Given that I have such a fork of this repo for GH-side integration, I’d be fine with maintaining such a repo.) This is the easiest solution client-wise.
  4. Take no action and I just keep patrickt/tree-sitter-swift around and update it regularly. This is doable for my purposes, but doesn’t resolve the problem of the broken crate. (If this is the way to go, I’d recommend pulling the crate from crates.io and indicating that consumers should embed this repo in their Rust projects.)

Since @alex-pinkus is the primary maintainer, I leave any decision up to him, but this is definitely an issue that’s affecting us in production, so I’d love to hear what I could do to help remedy this.

patrickt commented 6 months ago

Ah, never mind—my problem was that I was targeting your repo directly rather than the one on crates.io, where I see it is uploaded. Apologies for the noise!

alex-pinkus commented 6 months ago

The downside of using the published crate is that it doesn’t yet have the highlight fixes you added since the 0.4.1 release. I can get 0.4.2 out the door tonight; it’s mostly an automated process kicked off by the merge of a PR that bumps the versions in the appropriate files.

patrickt commented 6 months ago

Much appreciated!