0.18
There's a lot of open issues
A Ruby LSP addon that adds extra editor functionality for Rails applications
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.5.9897
>= 0.16.0, < 0.17.0
 Project Readme

Ruby LSP Rails

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

  • Hover over an ActiveRecord model to reveal its schema.
  • Run or debug a test by clicking on the code lens which appears above the test class, or an individual test.
  • Navigate to associations, validations, callbacks and test cases using your editor's "Go to Symbol" feature, or outline view.
  • Jump to the definition of callbacks using your editor's "Go to Definition" feature.

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

Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/ruby-lsp-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

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