Ruby LSP Rails

Ruby LSP Rails is a Ruby LSP addon for extra Rails editor features, such as:

Installation

If you haven’t already done so, you’ll need to first set up Ruby LSP.

As of v0.3.0, Ruby LSP will automatically include the Ruby LSP Rails addon in its custom bundle when a Rails app is detected. There is no need to add the gem to your bundle.

Documentation

See the documentation for more in-depth details about the supported features.

How Runtime Introspection Works

LSP tooling is typically based on static analysis, but ruby-lsp-rails actually communicates with your Rails app for some features.

When Ruby LSP Rails starts, it spawns a rails runner instance which runs {server.rb}. The addon communicates with this process over a pipe (i.e. stdin and stdout) to fetch runtime information about the application.

When extension is stopped (e.g. by quitting the editor), the server instance is shut down.

[!NOTE] Prior to v0.3.0, ruby-lsp-rails used a different approach which involved mounting a Rack application within the Rails app. That approach was brittle and susceptible to the application’s configuration, such as routing and middleware.

Contributing

See CONTRIBUTING.md

License

The gem is available as open source under the terms of the MIT License.