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
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 ```
|
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 |
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