zed-industries / extensions

Extensions for the Zed editor
572 stars 229 forks source link

Racket language server support #491

Open pocaeus opened 4 months ago

pocaeus commented 4 months ago

Check for existing issues

Language

Racket

Tree Sitter parser link

https://github.com/6cdh/tree-sitter-racket

Language server link

https://github.com/jeapostrophe/racket-langserver

Misc notes

Zed already supports racket syntax highlighting via tree-sitter-racket and I wanted to ask if adding the language server would be a welcome contribution before opening a PR (I have a branch and will test it shortly). I also understand if there's a preference to add that language server via a third-party extension instead when that functionality is ready (in which case I'm happy to close the issue!).

JosephTLyons commented 2 months ago

Just to note, the racket code currently resides in the Zed repo, but it will be removed as a built-in language and will be published to the extension store soon. Right now, it has tree-sitter support - all that is left is for someone to add the code to bring in the language server.

pocaeus commented 2 months ago

Great, thanks for the note @JosephTLyons! I'd be happy to add code to support the language server in the extension once the migration is complete.

(Link to the branch I originally spun up, should be pretty straight forward to port this to an extension I just need to reference some other examples to see if anything changed in the API)

JosephTLyons commented 2 months ago

You would need to add a crate to the extension and impl the zed::Extension trait:

That example shows downloading the language server from npm, but there are other extensions that download from GitHub releases.

pocaeus commented 2 months ago

Thanks for the reference. Would you happen to know if language extensions have a way of setting a "file icon"? e.g. in the previous built-in-to-zed way you could add an svg and add that to assets/icons/file_icons/file_types.json:

"racket": {
    "icon": "icons/file_icons/racket.svg"
}

Not critical or anything, just a nice touch 🙂