Solargraph ARC
Solargraph-arc was merged in solargraph-rails. Please use that repo for issues/PR.
Solargraph Awesome Rails Completions
Features
- fixes autocompletion for multi-level classes defined in 1 line
class Foo::Bar::Baz
. See castwide/solargraph#506 - autocomplete database columns by parsing db/schema.rb
- autocomplete of model relations
- parsing of
delegate
calls - completions for methods generated by Devise (
current_user
,sign_in_and_redirect
, etc) - better support for running solargraph outside bundle
- better completion inside controllers.
request
,response
,params
, etc. - autocomplete inside routes.rb
- autocomplete inside migrations
- completions for methods generated by ActiveStorage
- better ActiveRecord completions
Still, due to dynamic nature of some Rails code, not all completion candidates are returned. Things get worse when you chain methods. Without type information, Solargraph cannot deduce the object you are calling methods on.
For an up to date coverage report, please see https://github.com/alisnic/solargraph-arc/tree/master/coverage.
Supported Ruby/Rails versions
This gem currently supports:
- Ruby 2.5, 2.6, and 2.7. Ruby 3.0 almost works
- Rails 5 and Rails 6
Usage
-
Install gem and make sure your editor is integrated with solargraph
gem install solargraph-arc
-
If you project does not have a solagraph config, generate one using
solargraph config
-
update your project
.solargraph.yml
:# ... plugins: - solargraph-arc
-
if you use solargraph from bundle, don't forget to include
solagraph-arc
in your Gemfile -
IMPORTANT: Make sure yard documentation is built for your project (solargraph uses it for completions) Execute this in your project root:
$ yard gems
otherwise a lot of completions won't work
Troubleshooting
See https://solargraph.org/guides/troubleshooting
Contributing
-
create fork and clone the repo
-
install gem deps
bundle install
-
install dummy rails5 app deps and build its yard cache
$ cd spec/rails5 $ bundle install && yard gems $ cd ../../
-
install dummy rails6 app deps and build its yard cache
$ cd spec/rails6 $ bundle install && yard gems $ cd ../../
-
now tests should pass locally and you can try different changes
-
sumbit PR