Last active
October 24, 2024 16:26
-
Star
(103)
You must be signed in to star a gist -
Fork
(8)
You must be signed in to fork a gist
-
-
Save castwide/28b349566a223dfb439a337aea29713e to your computer and use it in GitHub Desktop.
Enhance Rails Intellisense in Solargraph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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>] |
You might be interested on the solargraph-rails gem instead of relying on this ad-hoc config file
You might be interested on the solargraph-rails gem instead of relying on this ad-hoc config file
There is no "Up vote" so... thanks!
This doesn't appear to have made a difference for me. I'm just confused at this point.
@Samuelodan I found answer in the entire rails thread castwide/solargraph#87
you might need to install docs. in my case what helped me was
gem install yard
yard docs
bundle add solargraph solargraph-rails
solargraph config
.solargraph.yml
---
include:
- "**/*.rb"
exclude:
- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
require:
- actioncable
- actionmailer
- actionpack
- actionview
- activejob
- activemodel
- activerecord
- activestorage
- activesupport
domains: []
reporters:
- rubocop
- require_not_found
formatter:
rubocop:
cops: safe
except: []
only: []
extra_args: []
require_paths: []
plugins:
- solargraph-rails
max_files: 5000
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Regardless of whether it's right or wrong, I feel that having more modules in the ActiveRecord can really help a lot in the development experience, and thus, I add the following:
extend all modules under Active Record
And some other thought...
.all
function says "ActiveRecord::Scoping::Named::ClassMethods#all Returns an ActiveRecord::Relation scope object") maybe we can use that information to annotate the function?Not sure whether it is possible or not, any thoughts?