From 985fe3f4c44e2ca9a9e7b0a746089e83ec3d0b8c Mon Sep 17 00:00:00 2001 From: Claudio Maradonna Date: Thu, 5 Aug 2021 01:32:02 +0200 Subject: [PATCH] feature: add solargraph configuration for ruby + rails autocompletion --- solargraph/definitions.rb | 31 +++++++++++++++++++++++++++++++ solargraph/solargraph.md | 14 ++++++++++++++ solargraph/solargraph.yml | 24 ++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 solargraph/definitions.rb create mode 100644 solargraph/solargraph.md create mode 100644 solargraph/solargraph.yml diff --git a/solargraph/definitions.rb b/solargraph/definitions.rb new file mode 100644 index 0000000..2feb002 --- /dev/null +++ b/solargraph/definitions.rb @@ -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] +# @overload find(*args) +# @return [Array] +# @return [self, Array] diff --git a/solargraph/solargraph.md b/solargraph/solargraph.md new file mode 100644 index 0000000..65f9e77 --- /dev/null +++ b/solargraph/solargraph.md @@ -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/` diff --git a/solargraph/solargraph.yml b/solargraph/solargraph.yml new file mode 100644 index 0000000..2bfade1 --- /dev/null +++ b/solargraph/solargraph.yml @@ -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