From 9b59ba780b05b552c15c29d11cb5adff2f9a19e0 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 16 Jun 2021 17:04:21 -0500 Subject: [PATCH] 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 --- .solargraph.yml | 21 +++++++++++++++++++++ Gemfile | 1 + Gemfile.lock | 38 +++++++++++++++++++++++++++++++++----- bin/solargraph | 29 +++++++++++++++++++++++++++++ config/solargraph.rb | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 118 insertions(+), 5 deletions(-) create mode 100644 .solargraph.yml create mode 100755 bin/solargraph create mode 100644 config/solargraph.rb diff --git a/.solargraph.yml b/.solargraph.yml new file mode 100644 index 000000000..bb21f098d --- /dev/null +++ b/.solargraph.yml @@ -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 diff --git a/Gemfile b/Gemfile index 19cd061f7..46bfe3728 100644 --- a/Gemfile +++ b/Gemfile @@ -82,6 +82,7 @@ group :development, :test do gem 'pry-byebug' gem 'pry-rails' gem 'listen' + gem 'solargraph' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index f907bb3e2..e35eee658 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -105,8 +105,10 @@ GEM aws-sigv4 (~> 1.1) aws-sigv4 (1.2.3) aws-eventstream (~> 1, >= 1.0.2) + backport (1.2.0) bcrypt (3.1.16) bcrypt_pbkdf (1.1.0) + benchmark (0.1.1) benchmark-ips (2.9.1) better_errors (2.9.1) coderay (>= 1.0.0) @@ -172,6 +174,7 @@ GEM dotenv-rails (2.7.6) dotenv (= 2.7.6) railties (>= 3.2) + e2mmap (0.1.0) ed25519 (1.2.4) erubi (1.10.0) factory_bot (6.2.0) @@ -255,10 +258,15 @@ GEM i18n (1.8.10) concurrent-ruby (~> 1.0) ipaddress_2 (0.13.0) + jaro_winkler (1.5.4) jmespath (1.4.0) json (2.5.1) jwt (2.2.3) kgio (2.11.3) + kramdown (2.3.1) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) listen (3.5.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -272,7 +280,7 @@ GEM memory_profiler (1.0.0) method_source (1.0.0) mini_mime (1.0.3) - mini_portile2 (2.5.1) + mini_portile2 (2.5.3) minitest (5.14.4) minitest-ci (3.4.0) minitest (>= 5.0.6) @@ -295,7 +303,7 @@ GEM net-ssh (6.1.0) newrelic_rpm (7.0.0) nio4r (2.5.7) - nokogiri (1.11.5) + nokogiri (1.11.7) mini_portile2 (~> 2.5.0) racc (~> 1.4) nokogumbo (2.0.5) @@ -377,17 +385,19 @@ GEM actionpack (>= 5.0) railties (>= 5.0) retriable (3.1.2) + reverse_markdown (2.0.0) + nokogiri rexml (3.2.5) - rubocop (1.15.0) + rubocop (1.17.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.5.0, < 2.0) + rubocop-ast (>= 1.7.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.5.0) + rubocop-ast (1.7.0) parser (>= 3.0.1.1) rubocop-rails (2.10.1) activesupport (>= 4.2.0) @@ -426,6 +436,21 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.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) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -447,6 +472,7 @@ GEM terminal-table (3.0.1) unicode-display_width (>= 1.1.1, < 3) thor (1.1.0) + tilt (2.0.10) trailblazer-option (0.1.1) tzinfo (2.0.4) concurrent-ruby (~> 1.0) @@ -478,6 +504,7 @@ GEM chronic (>= 0.6.3) xpath (3.2.0) nokogiri (~> 1.8) + yard (0.9.26) zeitwerk (2.4.2) PLATFORMS @@ -554,6 +581,7 @@ DEPENDENCIES shoulda-matchers simple_form simplecov + solargraph stackprof streamio-ffmpeg stripe diff --git a/bin/solargraph b/bin/solargraph new file mode 100755 index 000000000..23d1f9496 --- /dev/null +++ b/bin/solargraph @@ -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") diff --git a/config/solargraph.rb b/config/solargraph.rb new file mode 100644 index 000000000..c4d5d06c6 --- /dev/null +++ b/config/solargraph.rb @@ -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] +# @overload find(*args) +# @return [Array] +# @return [self, Array]