Introduce Kanayago LSP that provides real-time Ruby syntax checking#224
Introduce Kanayago LSP that provides real-time Ruby syntax checking#224S-H-GAMELINKS wants to merge 1 commit intozed-extensions:mainfrom
Conversation
|
I'm curious, what are the use cases for choosing this over Prism? |
|
Thanks for your comment. Prism is a hand-written recursive descent parser. This is a very deliberate design choice and provides a lot of flexibility for tooling. As a trade-off, supporting new Ruby syntax usually requires explicit manual updates to the parser. Kanayago, on the other hand, works with the AST generated directly from Ruby’s parse.y. Because it follows CRuby’s official grammar, support for new syntax tends to come more naturally as Ruby itself evolves, without requiring a separate parser implementation to be updated. This leads to a few practical use cases where Kanayago is especially useful:
There’s also a subtle edge-case difference worth mentioning. Because Prism is hand-written, there have been rare cases where syntactically invalid Ruby code was accepted as valid. One such real-world example is documented in a Ruby core issue: https://bugs.ruby-lang.org/issues/21337 Since Kanayago relies on parse.y, these kinds of edge cases are much less likely. |
|
The Ruby LSP + Prism combo already provides everything you mentioned. Since Prism is now the default Ruby parser (not |
|
Apologies for the delay. It took me a while to think about this addition. Overall, I don't mind merging this LSP into the Ruby extension, but before doing that we need to disable it in the default Zed settings github.com and resolve the merge conflicts. Thanks! |
|
In my case, I’m intentionally using the parse.y parser instead of Prism, I also think it’s valuable to provide an option for users who want to use the parse.y parser. Even if Prism becomes the long-term default parser, there may still be users who need compatibility with parse.y semantics. So this pull request is not meant to replace the Ruby LSP + Prism combination, but rather to offer an alternative choice for those use cases. |
|
Thanks for taking the time to review this. That makes sense. I’ll update this pull request, disable Kanayago in the default settings, and add it to the list of available language servers in Zed. |
Kanayago is a Ruby Language Server Protocol (LSP) implementation that provides: - Real-time Ruby syntax checking based on parse.y AST - AST-based Ruby code analysis - A lightweight LSP implementation written entirely in Ruby Users need to have the `kanayago` command available in their PATH: ```bash gem install kanayago ```
d8a13a3 to
aa5b4bf
Compare
|
I’ve updated the Zed settings in this pull request: When you have a chance, I’d appreciate it if you could take another look. |
Thank you for developing the Zed Ruby extension.
This PR adds support for Kanayago (金屋子), a Ruby Language Server that provides real-time Ruby syntax checking.
This is my first contribution to the Zed project, so please let me know if there is anything I should change or improve.
Summary
This PR adds the Kanayago extension to the Zed Ruby extensions repository.
What is Kanayago?
Kanayago is a Ruby Language Server Protocol (LSP) implementation that provides:
parse.yASTRequirements
Users need to have the
kanayagocommand available in their PATH:Demo
zed-ruby-extension-kanayago-demo.mp4
Repository