Set up a grammar with release branch
I would like to add perl support to zed. I maintain tree-sitter-perl/tree-sitter-perl, but we keep the built files on a special release branch. Am I able to wrap that up in an extension? The docs don't mention pointing to a particular branch
ref #158
When defining a grammar in extension.toml you can provide a commit SHA so that we know what commit to pull to build the grammar: https://github.com/zed-industries/zed/blob/9cb17ac630d65d94745a6174accc42551546a91d/extensions/gleam/extension.toml#L13-L15
So in your case you could use a commit SHA that refers to the release branch, and it should work fine.
Ah, thanks! Also, to clarify - you build the parser on your end? That means all you need is the grammar.json and the external scanner c code; not the prebuilt artifacts?
On Fri, Jul 19, 2024, 15:55 Marshall Bowers @.***> wrote:
When defining a grammar in extension.toml you can provide a commit SHA so that we know what commit to pull to build the grammar: https://github.com/zed-industries/zed/blob/9cb17ac630d65d94745a6174accc42551546a91d/extensions/gleam/extension.toml#L13-L15
So in your case you could use a commit SHA that refers to the release branch, and it should work fine.
— Reply to this email directly, view it on GitHub https://github.com/zed-industries/extensions/issues/1087#issuecomment-2239073110, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFURPKU3ZVUWDU5LQJPRGLLZNEECXAVCNFSM6AAAAABLDFUJNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZZGA3TGMJRGA . You are receiving this because you authored the thread.Message ID: @.***>
Ah, thanks! Also, to clarify - you build the parser on your end? That means all you need is the grammar.json and the external scanner c code; not the prebuilt artifacts? … On Fri, Jul 19, 2024, 15:55 Marshall Bowers @.> wrote: When defining a grammar in extension.toml you can provide a commit SHA so that we know what commit to pull to build the grammar: https://github.com/zed-industries/zed/blob/9cb17ac630d65d94745a6174accc42551546a91d/extensions/gleam/extension.toml#L13-L15 So in your case you could use a commit SHA that refers to the release branch, and it should work fine. — Reply to this email directly, view it on GitHub <#1087 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFURPKU3ZVUWDU5LQJPRGLLZNEECXAVCNFSM6AAAAABLDFUJNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZZGA3TGMJRGA . You are receiving this because you authored the thread.Message ID: @.>
We do need the generated parser.c (and whatever else).
We just build the Wasm file ourselves, not any of the other Tree-sitter artifacts.
One more question: how can I do local development? I can point to a local copy of the built wasm bindings? Bc itll probably be easier to play w the queries and stuff if I can run the thing
One more question: how can I do local development? I can point to a local copy of the built wasm bindings? Bc itll probably be easier to play w the queries and stuff if I can run the thing
Zed allows you to install dev extensions, which will build the Tree-sitter grammar for you:
https://github.com/zed-industries/extensions/blob/e49fad9e55989d8f87573743b12deb4aba0efa15/AUTHORING_EXTENSIONS.md#testing-your-extension-locally
Ah, thanks; I didn't connect that this is included in building the extension thanks.
Is there a more full documentation for the extension.toml?
@rabbiveesh Have you started work on an extension for Perl? I've been playing around with Zed recently, but nothing serious.
@rabbiveesh Have you started work on an extension for Perl? I've been playing around with Zed recently, but nothing serious.
Yes, so far have the syntax highlighting done (tho I could likely improve the queries a drop). I got nerdsniped a drop before I hooked up the LSP, but it seems like that should be easy enough; you can ping me as veesh on libera if you wanna work together on this
Can I see a link to the extension @rabbiveesh please? I'm keen on using it as a zed dev extension for now. Anything stopping you publishing it currently?
I'm working on setting up perlnavigator, but it's pending on a PR I have there. Aside from that I wanna expand the queries bc I haven't done brackets yet, and it's likely that I'm not using all the correct capture groups; I'm not able to push it now, but would be happy to tomorrow
On Tue, Sep 3, 2024, 22:27 Luke Naylor @.***> wrote:
Can I see a link to the extension @rabbiveesh https://github.com/rabbiveesh please? I'm keen on using it as a zed dev extension for now. Anything stopping you publishing it currently?
— Reply to this email directly, view it on GitHub https://github.com/zed-industries/extensions/issues/1087#issuecomment-2327264738, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFURPKXGWMTEMYKZ64VBXI3ZUYETLAVCNFSM6AAAAABLDFUJNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRXGI3DINZTHA . You are receiving this because you were mentioned.Message ID: @.***>
For the queries, one piece of advice I have (if you're happy to use neovim), is to use :EditQuery there to interactively try queries. Also in Zed, you can run "reload workspace" from the command palette to reload the queries quickly.
Also eagerly awaiting this goodness 👀 🌈 would love to kick the tires.
in progress here https://github.com/tree-sitter-perl/zed-perl
gonna close this now b/c my question was answered and the extension is awaiting a merge https://github.com/zed-industries/extensions/pull/1438