extensions icon indicating copy to clipboard operation
extensions copied to clipboard

Set up a grammar with release branch

Open rabbiveesh opened this issue 1 year ago • 6 comments

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

rabbiveesh avatar Jul 18 '24 18:07 rabbiveesh

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.

maxdeviant avatar Jul 19 '24 12:07 maxdeviant

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: @.***>

rabbiveesh avatar Jul 19 '24 13:07 rabbiveesh

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.

maxdeviant avatar Jul 19 '24 14:07 maxdeviant

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

rabbiveesh avatar Jul 19 '24 15:07 rabbiveesh

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

maxdeviant avatar Jul 19 '24 15:07 maxdeviant

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 avatar Jul 20 '24 18:07 rabbiveesh

@rabbiveesh Have you started work on an extension for Perl? I've been playing around with Zed recently, but nothing serious.

zmughal avatar Aug 30 '24 16:08 zmughal

@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

rabbiveesh avatar Aug 31 '24 17:08 rabbiveesh

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?

lnay avatar Sep 03 '24 19:09 lnay

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: @.***>

rabbiveesh avatar Sep 03 '24 20:09 rabbiveesh

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.

lnay avatar Sep 03 '24 20:09 lnay

Also eagerly awaiting this goodness 👀 🌈 would love to kick the tires.

wayneeseguin avatar Sep 04 '24 19:09 wayneeseguin

in progress here https://github.com/tree-sitter-perl/zed-perl

rabbiveesh avatar Sep 08 '24 20:09 rabbiveesh

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

rabbiveesh avatar Sep 22 '24 11:09 rabbiveesh