feature: add solargraph configuration for ruby + rails autocompletion

This commit is contained in:
Claudio Maradonna 2021-08-05 01:32:02 +02:00
parent 74b3a33af5
commit 985fe3f4c4
Signed by: claudiomaradonna
GPG key ID: B1EDCB4C3B05C387
3 changed files with 69 additions and 0 deletions

31
solargraph/definitions.rb Normal file
View file

@ -0,0 +1,31 @@
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
#
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
#
# @!parse
# class ActionController::Base
# include ActionController::MimeResponds
# extend ActiveSupport::Callbacks::ClassMethods
# extend AbstractController::Callbacks::ClassMethods
# end
# class ActiveRecord::Base
# extend ActiveRecord::QueryMethods
# extend ActiveRecord::FinderMethods
# extend ActiveRecord::Associations::ClassMethods
# extend ActiveRecord::Inheritance::ClassMethods
# include ActiveRecord::Persistence
# end
# @!override ActiveRecord::FinderMethods#find
# @overload find(id)
# @param id [Integer]
# @return [self]
# @overload find(list)
# @param list [Array]
# @return [Array<self>]
# @overload find(*args)
# @return [Array<self>]
# @return [self, Array<self>]

14
solargraph/solargraph.md Normal file
View file

@ -0,0 +1,14 @@
# Solargraph configuration
# Prerequisites
* `gem install solargraph`
* `gem install solargraph-rails`
# Quick setup
1. copy `.yml` file inside the root folder.
2. execute `solargraph download-core`
3. execute `yard gems`
4. execute `solargraph bundle`
5. copy `definitions.rb` into `${PROJECT}/config/`

24
solargraph/solargraph.yml Normal file
View file

@ -0,0 +1,24 @@
---
include:
- "app/**/*.rb"
- "lib/**/*.rb"
exclude:
- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
require: []
domains: []
reporters:
- rubocop
- require_not_found
formatter:
rubocop:
cops: safe
except: []
only: []
extra_args: []
require_paths: []
plugins:
- solargraph-rails
max_files: 15000