forked from OpenNeo/impress
Add Solargraph autocomplete while in development
This is a Ruby language server that integrates with my editor! Static analysis of Ruby and Rails is pretty tricky, but it's working and I think that's neat!!
This commit is contained in:
parent
a70b70be7d
commit
a37dda6af7
27 changed files with 221 additions and 2 deletions
24
.solargraph.yml
Normal file
24
.solargraph.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
include:
|
||||||
|
- "app/**/*.rb"
|
||||||
|
- "config/**/*.rb"
|
||||||
|
exclude:
|
||||||
|
- "spec/**/*"
|
||||||
|
- "test/**/*"
|
||||||
|
- "vendor/**/*"
|
||||||
|
- ".bundle/**/*"
|
||||||
|
require:
|
||||||
|
- actioncable
|
||||||
|
- actionmailer
|
||||||
|
- actionpack
|
||||||
|
- actionview
|
||||||
|
- activemodel
|
||||||
|
- activerecord
|
||||||
|
- activesupport
|
||||||
|
plugins:
|
||||||
|
- solargraph-rails
|
||||||
|
domains: []
|
||||||
|
reporters:
|
||||||
|
- require_not_found
|
||||||
|
require_paths: []
|
||||||
|
max_files: 5000
|
4
Gemfile
4
Gemfile
|
@ -85,3 +85,7 @@ gem "sentry-rails", "~> 5.12"
|
||||||
|
|
||||||
# For tasks that use shell commands.
|
# For tasks that use shell commands.
|
||||||
gem "shell", "~> 0.8.1"
|
gem "shell", "~> 0.8.1"
|
||||||
|
|
||||||
|
# For workspace autocomplete.
|
||||||
|
gem "solargraph", "~> 0.50.0", group: :development
|
||||||
|
gem "solargraph-rails", "~> 1.1", group: :development
|
||||||
|
|
58
Gemfile.lock
58
Gemfile.lock
|
@ -84,6 +84,7 @@ GEM
|
||||||
addressable (2.8.6)
|
addressable (2.8.6)
|
||||||
public_suffix (>= 2.0.2, < 6.0)
|
public_suffix (>= 2.0.2, < 6.0)
|
||||||
aes_key_wrap (1.1.0)
|
aes_key_wrap (1.1.0)
|
||||||
|
ast (2.4.2)
|
||||||
async (2.8.1)
|
async (2.8.1)
|
||||||
console (~> 1.10)
|
console (~> 1.10)
|
||||||
fiber-annotation
|
fiber-annotation
|
||||||
|
@ -111,8 +112,10 @@ GEM
|
||||||
babel-transpiler (0.7.0)
|
babel-transpiler (0.7.0)
|
||||||
babel-source (>= 4.0, < 6)
|
babel-source (>= 4.0, < 6)
|
||||||
execjs (~> 2.0)
|
execjs (~> 2.0)
|
||||||
|
backport (1.2.0)
|
||||||
base64 (0.2.0)
|
base64 (0.2.0)
|
||||||
bcrypt (3.1.20)
|
bcrypt (3.1.20)
|
||||||
|
benchmark (0.3.0)
|
||||||
bigdecimal (3.1.6)
|
bigdecimal (3.1.6)
|
||||||
bindata (2.5.0)
|
bindata (2.5.0)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
|
@ -136,6 +139,7 @@ GEM
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
devise-encryptable (0.2.0)
|
devise-encryptable (0.2.0)
|
||||||
devise (>= 2.1.0)
|
devise (>= 2.1.0)
|
||||||
|
diff-lcs (1.5.1)
|
||||||
dotenv (2.8.1)
|
dotenv (2.8.1)
|
||||||
dotenv-rails (2.8.1)
|
dotenv-rails (2.8.1)
|
||||||
dotenv (= 2.8.1)
|
dotenv (= 2.8.1)
|
||||||
|
@ -187,6 +191,7 @@ GEM
|
||||||
irb (1.11.2)
|
irb (1.11.2)
|
||||||
rdoc
|
rdoc
|
||||||
reline (>= 0.4.2)
|
reline (>= 0.4.2)
|
||||||
|
jaro_winkler (1.6.0)
|
||||||
jsbundling-rails (1.3.0)
|
jsbundling-rails (1.3.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
json (2.7.1)
|
json (2.7.1)
|
||||||
|
@ -197,6 +202,11 @@ GEM
|
||||||
bindata
|
bindata
|
||||||
faraday (~> 2.0)
|
faraday (~> 2.0)
|
||||||
faraday-follow_redirects
|
faraday-follow_redirects
|
||||||
|
kramdown (2.4.0)
|
||||||
|
rexml
|
||||||
|
kramdown-parser-gfm (1.1.0)
|
||||||
|
kramdown (~> 2.0)
|
||||||
|
language_server-protocol (3.17.0.3)
|
||||||
launchy (2.5.2)
|
launchy (2.5.2)
|
||||||
addressable (~> 2.8)
|
addressable (~> 2.8)
|
||||||
letter_opener (1.9.0)
|
letter_opener (1.9.0)
|
||||||
|
@ -261,6 +271,9 @@ GEM
|
||||||
openssl (3.2.0)
|
openssl (3.2.0)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
parallel (1.24.0)
|
parallel (1.24.0)
|
||||||
|
parser (3.3.3.0)
|
||||||
|
ast (~> 2.4.1)
|
||||||
|
racc
|
||||||
process-metrics (0.2.1)
|
process-metrics (0.2.1)
|
||||||
console (~> 1.8)
|
console (~> 1.8)
|
||||||
samovar (~> 2.1)
|
samovar (~> 2.1)
|
||||||
|
@ -332,7 +345,9 @@ GEM
|
||||||
rake (>= 12.2)
|
rake (>= 12.2)
|
||||||
thor (~> 1.0, >= 1.2.2)
|
thor (~> 1.0, >= 1.2.2)
|
||||||
zeitwerk (~> 2.6)
|
zeitwerk (~> 2.6)
|
||||||
|
rainbow (3.1.1)
|
||||||
rake (13.1.0)
|
rake (13.1.0)
|
||||||
|
rbs (2.8.4)
|
||||||
rdiscount (2.2.7.3)
|
rdiscount (2.2.7.3)
|
||||||
rdoc (6.6.2)
|
rdoc (6.6.2)
|
||||||
psych (>= 4.0.0)
|
psych (>= 4.0.0)
|
||||||
|
@ -344,11 +359,30 @@ GEM
|
||||||
tilt
|
tilt
|
||||||
record_tag_helper (1.0.1)
|
record_tag_helper (1.0.1)
|
||||||
actionview (>= 5)
|
actionview (>= 5)
|
||||||
|
regexp_parser (2.9.2)
|
||||||
reline (0.4.2)
|
reline (0.4.2)
|
||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
responders (3.1.1)
|
responders (3.1.1)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
railties (>= 5.2)
|
railties (>= 5.2)
|
||||||
|
reverse_markdown (2.1.1)
|
||||||
|
nokogiri
|
||||||
|
rexml (3.3.1)
|
||||||
|
strscan
|
||||||
|
rubocop (1.64.1)
|
||||||
|
json (~> 2.3)
|
||||||
|
language_server-protocol (>= 3.17.0)
|
||||||
|
parallel (~> 1.10)
|
||||||
|
parser (>= 3.3.0.2)
|
||||||
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
|
rexml (>= 3.2.5, < 4.0)
|
||||||
|
rubocop-ast (>= 1.31.1, < 2.0)
|
||||||
|
ruby-progressbar (~> 1.7)
|
||||||
|
unicode-display_width (>= 2.4.0, < 3.0)
|
||||||
|
rubocop-ast (1.31.3)
|
||||||
|
parser (>= 3.3.1.0)
|
||||||
|
ruby-progressbar (1.13.0)
|
||||||
ruby2_keywords (0.0.5)
|
ruby2_keywords (0.0.5)
|
||||||
samovar (2.2.0)
|
samovar (2.2.0)
|
||||||
console (~> 1.0)
|
console (~> 1.0)
|
||||||
|
@ -374,6 +408,25 @@ GEM
|
||||||
shell (0.8.1)
|
shell (0.8.1)
|
||||||
e2mmap
|
e2mmap
|
||||||
sync
|
sync
|
||||||
|
solargraph (0.50.0)
|
||||||
|
backport (~> 1.2)
|
||||||
|
benchmark
|
||||||
|
bundler (~> 2.0)
|
||||||
|
diff-lcs (~> 1.4)
|
||||||
|
e2mmap
|
||||||
|
jaro_winkler (~> 1.5)
|
||||||
|
kramdown (~> 2.3)
|
||||||
|
kramdown-parser-gfm (~> 1.1)
|
||||||
|
parser (~> 3.0)
|
||||||
|
rbs (~> 2.0)
|
||||||
|
reverse_markdown (~> 2.0)
|
||||||
|
rubocop (~> 1.38)
|
||||||
|
thor (~> 1.0)
|
||||||
|
tilt (~> 2.0)
|
||||||
|
yard (~> 0.9, >= 0.9.24)
|
||||||
|
solargraph-rails (1.1.0)
|
||||||
|
activesupport
|
||||||
|
solargraph
|
||||||
sprockets (4.2.1)
|
sprockets (4.2.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (>= 2.2.4, < 4)
|
rack (>= 2.2.4, < 4)
|
||||||
|
@ -383,6 +436,7 @@ GEM
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
stackprof (0.2.26)
|
stackprof (0.2.26)
|
||||||
stringio (3.1.0)
|
stringio (3.1.0)
|
||||||
|
strscan (3.1.0)
|
||||||
swd (2.0.3)
|
swd (2.0.3)
|
||||||
activesupport (>= 3)
|
activesupport (>= 3)
|
||||||
attr_required (>= 0.0.5)
|
attr_required (>= 0.0.5)
|
||||||
|
@ -404,6 +458,7 @@ GEM
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
tzinfo (2.0.6)
|
tzinfo (2.0.6)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
|
unicode-display_width (2.5.0)
|
||||||
uri (0.13.0)
|
uri (0.13.0)
|
||||||
validate_url (1.0.15)
|
validate_url (1.0.15)
|
||||||
activemodel (>= 3.0.0)
|
activemodel (>= 3.0.0)
|
||||||
|
@ -424,6 +479,7 @@ GEM
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
will_paginate (4.0.0)
|
will_paginate (4.0.0)
|
||||||
|
yard (0.9.36)
|
||||||
zeitwerk (2.6.13)
|
zeitwerk (2.6.13)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
|
@ -463,6 +519,8 @@ DEPENDENCIES
|
||||||
sentry-rails (~> 5.12)
|
sentry-rails (~> 5.12)
|
||||||
sentry-ruby (~> 5.12)
|
sentry-ruby (~> 5.12)
|
||||||
shell (~> 0.8.1)
|
shell (~> 0.8.1)
|
||||||
|
solargraph (~> 0.50.0)
|
||||||
|
solargraph-rails (~> 1.1)
|
||||||
sprockets (~> 4.2)
|
sprockets (~> 4.2)
|
||||||
stackprof (~> 0.2.25)
|
stackprof (~> 0.2.25)
|
||||||
terser (~> 1.1, >= 1.1.17)
|
terser (~> 1.1, >= 1.1.17)
|
||||||
|
|
110
bin/bundle
110
bin/bundle
|
@ -1,3 +1,109 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
# frozen_string_literal: true
|
||||||
load Gem.bin_path('bundler', 'bundle')
|
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'bundle' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require "rubygems"
|
||||||
|
|
||||||
|
m = Module.new do
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def invoked_as_script?
|
||||||
|
File.expand_path($0) == File.expand_path(__FILE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def env_var_version
|
||||||
|
ENV["BUNDLER_VERSION"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def cli_arg_version
|
||||||
|
return unless invoked_as_script? # don't want to hijack other binstubs
|
||||||
|
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
||||||
|
bundler_version = nil
|
||||||
|
update_index = nil
|
||||||
|
ARGV.each_with_index do |a, i|
|
||||||
|
if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
|
||||||
|
bundler_version = a
|
||||||
|
end
|
||||||
|
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
||||||
|
bundler_version = $1
|
||||||
|
update_index = i
|
||||||
|
end
|
||||||
|
bundler_version
|
||||||
|
end
|
||||||
|
|
||||||
|
def gemfile
|
||||||
|
gemfile = ENV["BUNDLE_GEMFILE"]
|
||||||
|
return gemfile if gemfile && !gemfile.empty?
|
||||||
|
|
||||||
|
File.expand_path("../Gemfile", __dir__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def lockfile
|
||||||
|
lockfile =
|
||||||
|
case File.basename(gemfile)
|
||||||
|
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
|
||||||
|
else "#{gemfile}.lock"
|
||||||
|
end
|
||||||
|
File.expand_path(lockfile)
|
||||||
|
end
|
||||||
|
|
||||||
|
def lockfile_version
|
||||||
|
return unless File.file?(lockfile)
|
||||||
|
lockfile_contents = File.read(lockfile)
|
||||||
|
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
||||||
|
Regexp.last_match(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
def bundler_requirement
|
||||||
|
@bundler_requirement ||=
|
||||||
|
env_var_version ||
|
||||||
|
cli_arg_version ||
|
||||||
|
bundler_requirement_for(lockfile_version)
|
||||||
|
end
|
||||||
|
|
||||||
|
def bundler_requirement_for(version)
|
||||||
|
return "#{Gem::Requirement.default}.a" unless version
|
||||||
|
|
||||||
|
bundler_gem_version = Gem::Version.new(version)
|
||||||
|
|
||||||
|
bundler_gem_version.approximate_recommendation
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_bundler!
|
||||||
|
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
||||||
|
|
||||||
|
activate_bundler
|
||||||
|
end
|
||||||
|
|
||||||
|
def activate_bundler
|
||||||
|
gem_error = activation_error_handling do
|
||||||
|
gem "bundler", bundler_requirement
|
||||||
|
end
|
||||||
|
return if gem_error.nil?
|
||||||
|
require_error = activation_error_handling do
|
||||||
|
require "bundler/version"
|
||||||
|
end
|
||||||
|
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
||||||
|
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
||||||
|
exit 42
|
||||||
|
end
|
||||||
|
|
||||||
|
def activation_error_handling
|
||||||
|
yield
|
||||||
|
nil
|
||||||
|
rescue StandardError, LoadError => e
|
||||||
|
e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
m.load_bundler!
|
||||||
|
|
||||||
|
if m.invoked_as_script?
|
||||||
|
load Gem.bin_path("bundler", "bundle")
|
||||||
|
end
|
||||||
|
|
27
bin/solargraph
Executable file
27
bin/solargraph
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/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.
|
||||||
|
#
|
||||||
|
|
||||||
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||||
|
|
||||||
|
bundle_binstub = File.expand_path("bundle", __dir__)
|
||||||
|
|
||||||
|
if File.file?(bundle_binstub)
|
||||||
|
if File.read(bundle_binstub, 300).include?("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")
|
BIN
vendor/cache/ast-2.4.2.gem
vendored
Normal file
BIN
vendor/cache/ast-2.4.2.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/backport-1.2.0.gem
vendored
Normal file
BIN
vendor/cache/backport-1.2.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/benchmark-0.3.0.gem
vendored
Normal file
BIN
vendor/cache/benchmark-0.3.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/diff-lcs-1.5.1.gem
vendored
Normal file
BIN
vendor/cache/diff-lcs-1.5.1.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/jaro_winkler-1.6.0.gem
vendored
Normal file
BIN
vendor/cache/jaro_winkler-1.6.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/kramdown-2.4.0.gem
vendored
Normal file
BIN
vendor/cache/kramdown-2.4.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/kramdown-parser-gfm-1.1.0.gem
vendored
Normal file
BIN
vendor/cache/kramdown-parser-gfm-1.1.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/language_server-protocol-3.17.0.3.gem
vendored
Normal file
BIN
vendor/cache/language_server-protocol-3.17.0.3.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/parser-3.3.3.0.gem
vendored
Normal file
BIN
vendor/cache/parser-3.3.3.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/rainbow-3.1.1.gem
vendored
Normal file
BIN
vendor/cache/rainbow-3.1.1.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/rbs-2.8.4.gem
vendored
Normal file
BIN
vendor/cache/rbs-2.8.4.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/regexp_parser-2.9.2.gem
vendored
Normal file
BIN
vendor/cache/regexp_parser-2.9.2.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/reverse_markdown-2.1.1.gem
vendored
Normal file
BIN
vendor/cache/reverse_markdown-2.1.1.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/rexml-3.3.1.gem
vendored
Normal file
BIN
vendor/cache/rexml-3.3.1.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/rubocop-1.64.1.gem
vendored
Normal file
BIN
vendor/cache/rubocop-1.64.1.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/rubocop-ast-1.31.3.gem
vendored
Normal file
BIN
vendor/cache/rubocop-ast-1.31.3.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/ruby-progressbar-1.13.0.gem
vendored
Normal file
BIN
vendor/cache/ruby-progressbar-1.13.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/solargraph-0.50.0.gem
vendored
Normal file
BIN
vendor/cache/solargraph-0.50.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/solargraph-rails-1.1.0.gem
vendored
Normal file
BIN
vendor/cache/solargraph-rails-1.1.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/strscan-3.1.0.gem
vendored
Normal file
BIN
vendor/cache/strscan-3.1.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/unicode-display_width-2.5.0.gem
vendored
Normal file
BIN
vendor/cache/unicode-display_width-2.5.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/yard-0.9.36.gem
vendored
Normal file
BIN
vendor/cache/yard-0.9.36.gem
vendored
Normal file
Binary file not shown.
Loading…
Reference in a new issue