0.02
Repository is archived
No release in over a year
Awesome Rails Completions for solargraph
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.17
~> 0.14.1
~> 10.0
~> 3.9.0

Runtime

 Project Readme

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

  1. Install gem and make sure your editor is integrated with solargraph

    gem install solargraph-arc
    
  2. If you project does not have a solagraph config, generate one using solargraph config

  3. update your project .solargraph.yml:

    # ...
    plugins:
      - solargraph-arc
  4. if you use solargraph from bundle, don't forget to include solagraph-arc in your Gemfile

  5. 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

  1. create fork and clone the repo

  2. install gem deps bundle install

  3. install dummy rails5 app deps and build its yard cache

    $ cd spec/rails5
    $ bundle install && yard gems
    $ cd ../../
    
  4. install dummy rails6 app deps and build its yard cache

    $ cd spec/rails6
    $ bundle install && yard gems
    $ cd ../../
    
  5. now tests should pass locally and you can try different changes

  6. sumbit PR