-
Notifications
You must be signed in to change notification settings - Fork 437
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
Add initial Unison support #361
Conversation
We require contributors to sign our Contributor License Agreement, and we don't have @zetashift on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
@cla-bot check |
We require contributors to sign our Contributor License Agreement, and we don't have @zetashift on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
The cla-bot has been summoned, and re-checked this pull request! |
@cla-bot check |
The cla-bot has been summoned, and re-checked this pull request! |
@zetashift Can we drop the Since these are all Zed extensions, there isn't a need to specify. It should be: id = "unison"
name = "Unison" It looks like the |
@maxdeviant I've updated the |
You need to bump the submodule commit to the new one. Typically this is done by going into the submodule directory ( |
Ah thank you! I also saw that I named the path wrong, e.g. it should be |
Could you say more about this? I'm not sure I follow. I would think any improvements to the Unison extension should go towards your extension, as opposed to creating new ones. |
Ah this was exactly what my question was about. I'll probably share that along then. https://github.com/zed-industries/extensions/actions/runs/8392887233/job/23063430084?pr=361#step:9:19 |
It's failing due to this error:
We don't expose |
We opened an issue on the Unison grammar repo: kylegoetz/tree-sitter-unison#57. |
Is there an issue or something to see when this lands in tree-sitter, and when Zed uses that specific version? Else I might forget this PR :P |
Tree-sitter already supports Right now we're blocked on the upstream grammar resolve this issue: kylegoetz/tree-sitter-unison#57 (or if you want to fork it to make the necessary adjustments). |
Does Zed( or the extensions part) use the master or is it pinned to a specific version?
I have a PR up kylegoetz/tree-sitter-unison#58 ! Let's see if it gets merged anytime soon :) |
We patch our And right now we're pinned to tree-sitter/tree-sitter@7f21c3b, so Zed already supports Wasm extensions using |
Is this WASM error from the parser or something external? I grepped tree-sitter-unison and it doesn't seem to use |
Maybe it calls |
Seems it does: https://github.com/search?q=repo%3Akylegoetz%2Ftree-sitter-unison%20fprintf&type=code |
@maxbrunsfeld could you or zetashift check this PR? kylegoetz/tree-sitter-unison#68 I'm conditionally excluding the fprintf stuff if |
We've used the Emscripten defines it as well, I believe, but it's not Emscripten-specific. We don't use Emscripten when compiling grammars for Zed AFAIK (unless it's somehow used under the hood). We're using Clang 17: https://github.com/zed-industries/zed/blob/a202499c9a61bbb7ec2498b196c94237223372a0/crates/extension/src/extension_builder.rs#L209-L219 |
@maxdeviant thanks, i've updated that branch to use the directive and we'll see if it works for @zetashift and then i'll merge that branch into main |
@kylegoetz this indeed fixes the
|
@maxbrunsfeld or @maxdeviant , any ideas for why this is happening, and if teh list of what is available is overly strict? If |
Here is the list of stdlib symbols that we expose to Tree-sitter Wasm builds: https://github.com/tree-sitter/tree-sitter/blob/4cd23ff6b0b74f35996cfec873c3ca6b0bfac2f7/lib/src/wasm/stdlib-symbols.txt We can expose more, if needed, but we've been conservative with adding them since each one can increase the base size of each Wasm bundle. |
Am I able to use |
I'll defer to @maxbrunsfeld here, as he's more familiar with Tree-sitter. |
@kylegoetz All types should be fine to use, but there are only certain libc functions available when running Tree-sitter parsers via wasm. The core library itself needs to provide the libc functions. If you run |
Okay, the only issue is That is the blocker for this PR, and I can't remove it because I don't know another way of converting string to double to validate that the sequence that's been read can be parsed as a |
@kylegoetz do you need to store the actual If the latter, I think it would be better to parse the float manually, since any libc function like
To be clear, that's a reason not to use |
Thanks for the advice, everyone! One issue was Unison's "REPL" would accept out-of-bounds So I've removed bounds checking from the scanner, which has dramatically simplified numeric parsing! @zetashift mind checking to see if you can build now? |
@zetashift @kylegoetz Thank you both for all your work getting this one published! |
Thanks for the patience to your and @maxbrunsfeld for patiently explaining some stuff to me. |
Thanks for getting this through the line! It's @kylegoetz who did the hard part! 🥇 |
Let me know if anything is missing! --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Let me know if anything is missing! --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Let me know if anything is missing!