ruby-lsp-rails-partial

CI

A Ruby LSP add-on that understands the partial name string of Rails render calls and provides:

  • Go to definition — jump from render 'admin/areas/form' (or render partial: '...') to the matching partial file. When multiple formats match, all candidates are offered.
  • Completion — complete partial names while typing inside the string. Partials in the same directory are offered as bare names; others use the path form.
  • Hover — show the list of resolved partial files as Markdown links.

Bare names (render 'form') are resolved relative to the current view's directory, or to the controller name when called from a controller. Locale and variant qualifiers (_form.en.html.erb, _form.html+phone.erb) are treated as the same partial.

Installation

Add the gem to your application's Gemfile:

group :development do
  gem 'ruby-lsp-rails-partial', require: false
end

Then run bundle install and restart the Ruby LSP server in your editor. The add-on is discovered automatically by Ruby LSP via the lib/ruby_lsp/**/addon.rb convention.

Scope

The view root is fixed to app/views. prepend_view_path / append_view_path and independent engines are not supported.

Development

bundle install
bundle exec rake test

License

MIT