gems: add solargraph gem

Add the Solargraph gem to enable Ruby language integration for
supporting text editors.

This enables various features, including code completion, inline
documentation, type checking, syntax checking, linting, and jump to
definition/references.

Usage:

  Install Solargraph extension for your editor (see https://solargraph.org/guides)
  Run `bin/solargraph download-core` to install core Ruby language docs.
  Run `bin/solargraph bundle` to install Ruby gem docs.

See also:

* https://github.com/castwide/solargraph
* https://solargraph.org/guides/getting-started
* https://marketplace.visualstudio.com/items?itemName=castwide.solargraph
This commit is contained in:
evazion
2021-06-16 17:04:21 -05:00
parent 6e2a5c6dde
commit 9b59ba780b
5 changed files with 118 additions and 5 deletions

21
.solargraph.yml Normal file
View File

@@ -0,0 +1,21 @@
---
include:
- "**/*.rb"
exclude:
- test/**/*
require: []
domains: []
reporters:
- rubocop
- require_not_found
- typecheck:typed
- update_errors
formatter:
rubocop:
cops: safe
except: []
only: []
extra_args: []
require_paths: []
plugins: []
max_files: 5000

View File

@@ -82,6 +82,7 @@ group :development, :test do
gem 'pry-byebug' gem 'pry-byebug'
gem 'pry-rails' gem 'pry-rails'
gem 'listen' gem 'listen'
gem 'solargraph'
end end
group :test do group :test do

View File

@@ -105,8 +105,10 @@ GEM
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
aws-sigv4 (1.2.3) aws-sigv4 (1.2.3)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
backport (1.2.0)
bcrypt (3.1.16) bcrypt (3.1.16)
bcrypt_pbkdf (1.1.0) bcrypt_pbkdf (1.1.0)
benchmark (0.1.1)
benchmark-ips (2.9.1) benchmark-ips (2.9.1)
better_errors (2.9.1) better_errors (2.9.1)
coderay (>= 1.0.0) coderay (>= 1.0.0)
@@ -172,6 +174,7 @@ GEM
dotenv-rails (2.7.6) dotenv-rails (2.7.6)
dotenv (= 2.7.6) dotenv (= 2.7.6)
railties (>= 3.2) railties (>= 3.2)
e2mmap (0.1.0)
ed25519 (1.2.4) ed25519 (1.2.4)
erubi (1.10.0) erubi (1.10.0)
factory_bot (6.2.0) factory_bot (6.2.0)
@@ -255,10 +258,15 @@ GEM
i18n (1.8.10) i18n (1.8.10)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
ipaddress_2 (0.13.0) ipaddress_2 (0.13.0)
jaro_winkler (1.5.4)
jmespath (1.4.0) jmespath (1.4.0)
json (2.5.1) json (2.5.1)
jwt (2.2.3) jwt (2.2.3)
kgio (2.11.3) kgio (2.11.3)
kramdown (2.3.1)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
listen (3.5.1) listen (3.5.1)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
@@ -272,7 +280,7 @@ GEM
memory_profiler (1.0.0) memory_profiler (1.0.0)
method_source (1.0.0) method_source (1.0.0)
mini_mime (1.0.3) mini_mime (1.0.3)
mini_portile2 (2.5.1) mini_portile2 (2.5.3)
minitest (5.14.4) minitest (5.14.4)
minitest-ci (3.4.0) minitest-ci (3.4.0)
minitest (>= 5.0.6) minitest (>= 5.0.6)
@@ -295,7 +303,7 @@ GEM
net-ssh (6.1.0) net-ssh (6.1.0)
newrelic_rpm (7.0.0) newrelic_rpm (7.0.0)
nio4r (2.5.7) nio4r (2.5.7)
nokogiri (1.11.5) nokogiri (1.11.7)
mini_portile2 (~> 2.5.0) mini_portile2 (~> 2.5.0)
racc (~> 1.4) racc (~> 1.4)
nokogumbo (2.0.5) nokogumbo (2.0.5)
@@ -377,17 +385,19 @@ GEM
actionpack (>= 5.0) actionpack (>= 5.0)
railties (>= 5.0) railties (>= 5.0)
retriable (3.1.2) retriable (3.1.2)
reverse_markdown (2.0.0)
nokogiri
rexml (3.2.5) rexml (3.2.5)
rubocop (1.15.0) rubocop (1.17.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.0.0.0) parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml rexml
rubocop-ast (>= 1.5.0, < 2.0) rubocop-ast (>= 1.7.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.5.0) rubocop-ast (1.7.0)
parser (>= 3.0.1.1) parser (>= 3.0.1.1)
rubocop-rails (2.10.1) rubocop-rails (2.10.1)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
@@ -426,6 +436,21 @@ GEM
simplecov_json_formatter (~> 0.1) simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3) simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3) simplecov_json_formatter (0.1.3)
solargraph (0.42.3)
backport (~> 1.2)
benchmark
bundler (>= 1.17.2)
diff-lcs (~> 1.4)
e2mmap
jaro_winkler (~> 1.5)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
parser (~> 3.0)
reverse_markdown (>= 1.0.5, < 3)
rubocop (>= 0.52)
thor (~> 1.0)
tilt (~> 2.0)
yard (~> 0.9, >= 0.9.24)
sprockets (4.0.2) sprockets (4.0.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
@@ -447,6 +472,7 @@ GEM
terminal-table (3.0.1) terminal-table (3.0.1)
unicode-display_width (>= 1.1.1, < 3) unicode-display_width (>= 1.1.1, < 3)
thor (1.1.0) thor (1.1.0)
tilt (2.0.10)
trailblazer-option (0.1.1) trailblazer-option (0.1.1)
tzinfo (2.0.4) tzinfo (2.0.4)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
@@ -478,6 +504,7 @@ GEM
chronic (>= 0.6.3) chronic (>= 0.6.3)
xpath (3.2.0) xpath (3.2.0)
nokogiri (~> 1.8) nokogiri (~> 1.8)
yard (0.9.26)
zeitwerk (2.4.2) zeitwerk (2.4.2)
PLATFORMS PLATFORMS
@@ -554,6 +581,7 @@ DEPENDENCIES
shoulda-matchers shoulda-matchers
simple_form simple_form
simplecov simplecov
solargraph
stackprof stackprof
streamio-ffmpeg streamio-ffmpeg
stripe stripe

29
bin/solargraph Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'solargraph' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
bundle_binstub = File.expand_path("../bundle", __FILE__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("solargraph", "solargraph")

34
config/solargraph.rb Normal file
View File

@@ -0,0 +1,34 @@
# https://solargraph.org/guides/rails
# https://gist.github.com/castwide/28b349566a223dfb439a337aea29713e
#
# 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>]