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

racket-langserver LSP support for Racket #1828

Open
1 task done
bhargavkulk opened this issue Aug 5, 2024 · 7 comments
Open
1 task done

racket-langserver LSP support for Racket #1828

bhargavkulk opened this issue Aug 5, 2024 · 7 comments
Labels
language A request to add a language extension

Comments

@bhargavkulk
Copy link

Check for existing issues

  • Completed

Describe the feature

Hi. Thanks for all the phenomenal work on this editor. The Racket programming language has an LSP called racket-langserver. It would be very nice and useful if the official Racket extension in Zed could support this LSP.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@JosephTLyons JosephTLyons added the language A request to add a language extension label Aug 6, 2024
@spdegabrielle
Copy link

can the https://github.com/zed-industries/zed/tree/main/extensions/clojure be used as a starting point?

@SomeoneToIgnore SomeoneToIgnore transferred this issue from zed-industries/zed Dec 24, 2024
@Reilithion
Copy link

I tried implementing this by copying the racket extension from the zed main repo, adding a Cargo.toml and a racket.rs that implements language_server_command, and adding it as a dev extension. It seems to add the extension just fine (I can see it in Extensions, with the new version number and my name in the authors), but there is no change in behavior in Zed when editing Racket source files. Checking with ps -ef, it seems like Zed isn't even attempting to run the language server. Is there something specific I need to do to get it to make use of the language server?

@spdegabrielle
Copy link

Is there something specific I need to do to get it to make use of the language server?

Only what is in the readme https://github.com/jeapostrophe/racket-langserver?tab=readme-ov-file#racket-langserver

@bhargavkulk
Copy link
Author

I had the same issue when I tried changing the extension to support the lsp server. Tangentially, the syntax highlighting for racket code is pretty poor. The treesitter syntax supports complex forms like match, match-define etc, but the the syntax definitions on Zed's side are very bare bones. Racket is not just brackets, tokens, and whitespace!

@Reilithion
Copy link

Only what is in the readme https://github.com/jeapostrophe/racket-langserver?tab=readme-ov-file#racket-langserver

I more meant on the Zed side of things, rather than the Racket language server side. I tried using the command to restart the language server, but it didn't seem to do anything. I'm wondering if the built-in extension for Racket support is taking precedence over my dev extension for handling .rkt files...

@Reilithion
Copy link

Ah! After some fiddling, I got it to work. I needed this in my extension.toml file:

[language_servers.racket]
name = "Racket LSP"
languages = ["Racket"]

And the "Racket" in the square brackets had to be capitalized. I'm still not entirely sure where the name it has to match is defined. Maybe it's the Name field in languages/racket/config.toml? Anyway, as soon as I figure out a slightly less hard-coded way to locate the racket binary I'll throw this in a repo and make a pull request.

@Reilithion
Copy link

I've submitted a pull request: #1857

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language A request to add a language extension
Projects
None yet
Development

No branches or pull requests

4 participants