Skip to content

Conversation

@S-H-GAMELINKS
Copy link

@S-H-GAMELINKS S-H-GAMELINKS commented Dec 30, 2025

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:

  • Real-time Ruby syntax checking based on Ruby’s parse.y AST
  • AST-based Ruby code analysis
  • A lightweight LSP implementation written entirely in Ruby

Requirements

Users need to have the kanayago command available in their PATH:

gem install kanayago

Demo

zed-ruby-extension-kanayago-demo.mp4

Repository

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
```
@andyw8
Copy link
Contributor

andyw8 commented Dec 30, 2025

I'm curious, what are the use cases for choosing this over Prism?

@S-H-GAMELINKS
Copy link
Author

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:

  • Trying out or validating new Ruby syntax in the editor
    Kanayago runs CI against Ruby’s master branch. While this is not an official support guarantee, it provides a practical environment for experimenting with upcoming or recently introduced syntax directly in Zed.

  • Early, strict syntax feedback
    Because parse.y is an LR parser, Kanayago inherits stricter grammar validation from CRuby itself. This makes it well-suited for catching syntax errors early, even in incomplete or experimental code.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants