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

fetch grammars by URL #1970

Open
the-mikedavis opened this issue Apr 6, 2022 · 0 comments
Open

fetch grammars by URL #1970

the-mikedavis opened this issue Apr 6, 2022 · 0 comments
Assignees
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@the-mikedavis
Copy link
Member

the-mikedavis commented Apr 6, 2022

I've been working on improving packaging in https://github.com/helix-editor/tspm and IMO it's pretty close to being usable for all grammars.

For most grammars, pulling from TSPM is not a big difference. It's just a smaller/faster download.

For some oddly shaped grammars like tree-sitter-ocaml or tree-sitter-typescript (multiple grammars in one repository), it helps reduce the complexity of the build: we wouldn't need the subpath config.

Other grammars like tree-sitter-rescript or alex-pinkus/tree-sitter-swift (don't store generated C files in the git repo, #1964) would benefit more concretely. We wouldn't need to maintain any forks that check the generated C into the repo.

As a bonus for Nix packaging, the pkgs.tspm.io links contain the SHA256 hash of the file, which we can use it to construct a fixed-output-derivation (FODs can be cached infinitely which solves #1779).

The [[grammar]] config in languages.toml should accept a new source which would be used like so:

[[grammar]]
name = "elixir"
source = { url = "https://pkgs.tspm.io/elixir/elixir-lang/a11a686303355a518b0a45dea7c77c5eebb5ec22-0.20.6-13-956eb868f38544dedcd5ef45f0ecc7cab542c68b89fae631e149008ad5cc72e8-src.tar.gz" }

Implementation-wise we have two kinda bad options:

  1. take a dependency on a Rust HTTP client
  2. take a runtime dependency on curl or similar

I lean towards (2). So we'd be switching from having a runtime dependency on git to curl. That's not super ideal but I think it's acceptable: you only need curl if you want to hx -g fetch, and package-managers pre-fetch and build grammars, so most users will not need to care about this at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

1 participant