solargraph 0.44.3 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/rspec.yml +41 -0
- data/CHANGELOG.md +57 -0
- data/LICENSE +1 -1
- data/README.md +18 -2
- data/SPONSORS.md +2 -2
- data/lib/solargraph/api_map/store.rb +13 -1
- data/lib/solargraph/api_map.rb +57 -34
- data/lib/solargraph/cache.rb +51 -0
- data/lib/solargraph/complex_type/type_methods.rb +10 -6
- data/lib/solargraph/complex_type/unique_type.rb +57 -0
- data/lib/solargraph/complex_type.rb +35 -2
- data/lib/solargraph/convention/rakefile.rb +17 -0
- data/lib/solargraph/convention/rspec.rb +13 -4
- data/lib/solargraph/convention.rb +2 -0
- data/lib/solargraph/diagnostics/require_not_found.rb +16 -0
- data/lib/solargraph/diagnostics/rubocop.rb +17 -3
- data/lib/solargraph/diagnostics/rubocop_helpers.rb +3 -1
- data/lib/solargraph/language_server/host.rb +22 -18
- data/lib/solargraph/language_server/message/extended/download_core.rb +1 -5
- data/lib/solargraph/language_server/message/initialize.rb +2 -0
- data/lib/solargraph/language_server/message/text_document/formatting.rb +1 -1
- data/lib/solargraph/language_server/message/text_document/hover.rb +16 -4
- data/lib/solargraph/language_server/message/text_document/signature_help.rb +1 -6
- data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +10 -3
- data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +1 -1
- data/lib/solargraph/language_server/uri_helpers.rb +1 -1
- data/lib/solargraph/library.rb +21 -20
- data/lib/solargraph/parser/legacy/class_methods.rb +0 -5
- data/lib/solargraph/parser/legacy/node_processors/casgn_node.rb +12 -2
- data/lib/solargraph/parser/legacy/node_processors/sclass_node.rb +24 -3
- data/lib/solargraph/parser/rubyvm/class_methods.rb +8 -4
- data/lib/solargraph/parser/rubyvm/node_processors/casgn_node.rb +13 -2
- data/lib/solargraph/parser/rubyvm/node_processors/def_node.rb +20 -9
- data/lib/solargraph/parser/rubyvm/node_processors/defs_node.rb +14 -3
- data/lib/solargraph/parser/rubyvm/node_processors/kw_arg_node.rb +2 -2
- data/lib/solargraph/parser/rubyvm/node_processors/sclass_node.rb +14 -3
- data/lib/solargraph/parser/rubyvm/node_processors/send_node.rb +4 -2
- data/lib/solargraph/parser/rubyvm/node_processors.rb +1 -0
- data/lib/solargraph/parser/rubyvm/node_wrapper.rb +47 -0
- data/lib/solargraph/pin/base.rb +5 -2
- data/lib/solargraph/pin/block.rb +2 -1
- data/lib/solargraph/pin/conversions.rb +2 -6
- data/lib/solargraph/pin/method.rb +100 -10
- data/lib/solargraph/pin/namespace.rb +4 -1
- data/lib/solargraph/pin/parameter.rb +10 -7
- data/lib/solargraph/pin/search.rb +56 -0
- data/lib/solargraph/pin/signature.rb +23 -0
- data/lib/solargraph/pin.rb +2 -0
- data/lib/solargraph/range.rb +1 -1
- data/lib/solargraph/rbs_map/conversions.rb +394 -0
- data/lib/solargraph/rbs_map/core_fills.rb +61 -0
- data/lib/solargraph/rbs_map/core_map.rb +38 -0
- data/lib/solargraph/rbs_map/core_signs.rb +33 -0
- data/lib/solargraph/rbs_map/stdlib_map.rb +36 -0
- data/lib/solargraph/rbs_map.rb +73 -0
- data/lib/solargraph/shell.rb +38 -30
- data/lib/solargraph/source/chain/call.rb +34 -23
- data/lib/solargraph/source/chain.rb +21 -6
- data/lib/solargraph/source.rb +1 -1
- data/lib/solargraph/source_map/clip.rb +5 -0
- data/lib/solargraph/source_map/mapper.rb +31 -2
- data/lib/solargraph/source_map.rb +1 -10
- data/lib/solargraph/type_checker/checks.rb +13 -0
- data/lib/solargraph/type_checker.rb +90 -61
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/views/environment.erb +2 -2
- data/lib/solargraph/workspace.rb +12 -14
- data/lib/solargraph/yard_map/mapper/to_method.rb +7 -4
- data/lib/solargraph/yard_map.rb +54 -196
- data/lib/solargraph.rb +4 -4
- data/solargraph.gemspec +8 -6
- metadata +46 -37
- data/lib/solargraph/compat.rb +0 -37
- data/lib/solargraph/yard_map/core_docs.rb +0 -170
- data/lib/solargraph/yard_map/core_fills.rb +0 -203
- data/lib/solargraph/yard_map/core_gen.rb +0 -76
- data/lib/solargraph/yard_map/rdoc_to_yard.rb +0 -140
- data/lib/solargraph/yard_map/stdlib_fills.rb +0 -43
- data/yardoc/2.2.2.tar.gz +0 -0
data/lib/solargraph/yard_map.rb
CHANGED
|
@@ -13,34 +13,13 @@ module Solargraph
|
|
|
13
13
|
class NoYardocError < StandardError; end
|
|
14
14
|
|
|
15
15
|
autoload :Cache, 'solargraph/yard_map/cache'
|
|
16
|
-
autoload :CoreDocs, 'solargraph/yard_map/core_docs'
|
|
17
|
-
autoload :CoreGen, 'solargraph/yard_map/core_gen'
|
|
18
16
|
autoload :Mapper, 'solargraph/yard_map/mapper'
|
|
19
17
|
autoload :RdocToYard, 'solargraph/yard_map/rdoc_to_yard'
|
|
20
|
-
autoload :CoreFills, 'solargraph/yard_map/core_fills'
|
|
21
|
-
autoload :StdlibFills, 'solargraph/yard_map/stdlib_fills'
|
|
22
18
|
autoload :Helpers, 'solargraph/yard_map/helpers'
|
|
23
19
|
autoload :ToMethod, 'solargraph/yard_map/to_method'
|
|
24
20
|
|
|
25
21
|
include ApiMap::BundlerMethods
|
|
26
22
|
|
|
27
|
-
CoreDocs.require_minimum
|
|
28
|
-
|
|
29
|
-
def stdlib_paths
|
|
30
|
-
@@stdlib_paths ||= begin
|
|
31
|
-
result = {}
|
|
32
|
-
YARD::Registry.load! CoreDocs.yardoc_stdlib_file
|
|
33
|
-
YARD::Registry.all.each do |co|
|
|
34
|
-
next if co.file.nil?
|
|
35
|
-
path = co.file.sub(/^(ext|lib)\//, '').sub(/\.(rb|c)$/, '')
|
|
36
|
-
base = path.split('/').first
|
|
37
|
-
result[base] ||= []
|
|
38
|
-
result[base].push co
|
|
39
|
-
end
|
|
40
|
-
result
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
23
|
# @return [Boolean]
|
|
45
24
|
attr_writer :with_dependencies
|
|
46
25
|
|
|
@@ -80,6 +59,7 @@ module Solargraph
|
|
|
80
59
|
@rebindable_method_names = nil
|
|
81
60
|
@pin_class_hash = nil
|
|
82
61
|
@pin_select_cache = {}
|
|
62
|
+
pins.each { |p| p.source = :yard }
|
|
83
63
|
true
|
|
84
64
|
end
|
|
85
65
|
|
|
@@ -107,6 +87,11 @@ module Solargraph
|
|
|
107
87
|
@unresolved_requires ||= []
|
|
108
88
|
end
|
|
109
89
|
|
|
90
|
+
# @return [Array<String>]
|
|
91
|
+
def missing_docs
|
|
92
|
+
@missing_docs ||= []
|
|
93
|
+
end
|
|
94
|
+
|
|
110
95
|
# @param y [String]
|
|
111
96
|
# @return [YARD::Registry]
|
|
112
97
|
def load_yardoc y
|
|
@@ -121,12 +106,6 @@ module Solargraph
|
|
|
121
106
|
nil
|
|
122
107
|
end
|
|
123
108
|
|
|
124
|
-
# @return [Array<Solargraph::Pin::Base>]
|
|
125
|
-
def core_pins
|
|
126
|
-
# Using a class variable to reduce loads
|
|
127
|
-
@@core_pins ||= load_core_pins
|
|
128
|
-
end
|
|
129
|
-
|
|
130
109
|
# @param path [String]
|
|
131
110
|
# @return [Pin::Base]
|
|
132
111
|
def path_pin path
|
|
@@ -150,10 +129,6 @@ module Solargraph
|
|
|
150
129
|
nil
|
|
151
130
|
end
|
|
152
131
|
|
|
153
|
-
def stdlib_pins
|
|
154
|
-
@stdlib_pins ||= []
|
|
155
|
-
end
|
|
156
|
-
|
|
157
132
|
def base_required
|
|
158
133
|
@base_required ||= Set.new
|
|
159
134
|
end
|
|
@@ -194,12 +169,12 @@ module Solargraph
|
|
|
194
169
|
def process_requires
|
|
195
170
|
@gemset = process_gemsets
|
|
196
171
|
required.merge @gemset.keys if required.include?('bundler/require')
|
|
197
|
-
pins.
|
|
172
|
+
pins.clear
|
|
198
173
|
unresolved_requires.clear
|
|
199
|
-
|
|
174
|
+
missing_docs.clear
|
|
200
175
|
environ = Convention.for_global(self)
|
|
201
176
|
done = []
|
|
202
|
-
|
|
177
|
+
already_errored = []
|
|
203
178
|
(required + environ.requires).each do |r|
|
|
204
179
|
next if r.nil? || r.empty? || done.include?(r)
|
|
205
180
|
done.push r
|
|
@@ -208,36 +183,7 @@ module Solargraph
|
|
|
208
183
|
pins.concat cached
|
|
209
184
|
next
|
|
210
185
|
end
|
|
211
|
-
result =
|
|
212
|
-
begin
|
|
213
|
-
spec = spec_for_require(r)
|
|
214
|
-
if @source_gems.include?(spec.name)
|
|
215
|
-
next
|
|
216
|
-
end
|
|
217
|
-
next if @gem_paths.key?(spec.name)
|
|
218
|
-
yd = yardoc_file_for_spec(spec)
|
|
219
|
-
# YARD detects gems for certain libraries that do not have a yardoc
|
|
220
|
-
# but exist in the stdlib. `fileutils` is an example. Treat those
|
|
221
|
-
# cases as errors and check the stdlib yardoc.
|
|
222
|
-
raise Gem::LoadError if yd.nil?
|
|
223
|
-
@gem_paths[spec.name] = spec.full_gem_path
|
|
224
|
-
unless yardocs.include?(yd)
|
|
225
|
-
yardocs.unshift yd
|
|
226
|
-
result.concat process_yardoc yd, spec
|
|
227
|
-
result.concat add_gem_dependencies(spec) if with_dependencies?
|
|
228
|
-
end
|
|
229
|
-
rescue Gem::LoadError, NoYardocError => e
|
|
230
|
-
base = r.split('/').first
|
|
231
|
-
next if from_std.include?(base)
|
|
232
|
-
from_std.push base
|
|
233
|
-
stdtmp = load_stdlib_pins(base)
|
|
234
|
-
if stdtmp.empty?
|
|
235
|
-
unresolved_requires.push r
|
|
236
|
-
else
|
|
237
|
-
stdlib_pins.concat stdtmp
|
|
238
|
-
result.concat stdtmp
|
|
239
|
-
end
|
|
240
|
-
end
|
|
186
|
+
result = pins_for_require r, already_errored
|
|
241
187
|
result.delete_if(&:nil?)
|
|
242
188
|
unless result.empty?
|
|
243
189
|
cache.set_path_pins r, result
|
|
@@ -253,36 +199,52 @@ module Solargraph
|
|
|
253
199
|
pins.concat environ.pins
|
|
254
200
|
end
|
|
255
201
|
|
|
202
|
+
def process_error(req, result, already_errored, yd = 1)
|
|
203
|
+
base = req.split('/').first
|
|
204
|
+
return if already_errored.include?(base)
|
|
205
|
+
already_errored.push base
|
|
206
|
+
if yd.nil?
|
|
207
|
+
missing_docs.push req
|
|
208
|
+
else
|
|
209
|
+
unresolved_requires.push req
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
256
213
|
def process_gemsets
|
|
257
214
|
return {} if directory.empty? || !File.file?(File.join(directory, 'Gemfile'))
|
|
258
215
|
require_from_bundle(directory)
|
|
259
216
|
end
|
|
260
217
|
|
|
261
|
-
# @param
|
|
262
|
-
|
|
263
|
-
def add_gem_dependencies spec
|
|
218
|
+
# @param r [String]
|
|
219
|
+
def pins_for_require r, already_errored
|
|
264
220
|
result = []
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
221
|
+
begin
|
|
222
|
+
name = r.split('/').first
|
|
223
|
+
return [] if @source_gems.include?(name) || @gem_paths.key?(name)
|
|
224
|
+
spec = spec_for_require(name)
|
|
225
|
+
@gem_paths[name] = spec.full_gem_path
|
|
226
|
+
|
|
227
|
+
yd = yardoc_file_for_spec(spec)
|
|
228
|
+
# YARD detects gems for certain libraries that do not have a yardoc
|
|
229
|
+
# but exist in the stdlib. `fileutils` is an example. Treat those
|
|
230
|
+
# cases as errors and check the stdlib yardoc.
|
|
231
|
+
if yd.nil?
|
|
232
|
+
process_error(r, result, already_errored, nil)
|
|
233
|
+
return []
|
|
234
|
+
end
|
|
235
|
+
unless yardocs.include?(yd)
|
|
236
|
+
yardocs.unshift yd
|
|
237
|
+
result.concat process_yardoc yd, spec
|
|
238
|
+
if with_dependencies?
|
|
239
|
+
(spec.dependencies - spec.development_dependencies).each do |dep|
|
|
240
|
+
result.concat pins_for_require dep.name, already_errored
|
|
241
|
+
end
|
|
279
242
|
end
|
|
280
|
-
rescue Gem::LoadError
|
|
281
|
-
# This error probably indicates a bug in an installed gem
|
|
282
|
-
Solargraph::Logging.logger.warn "Failed to resolve #{dep.name} gem dependency for #{spec.name}"
|
|
283
243
|
end
|
|
244
|
+
rescue Gem::LoadError, NoYardocError
|
|
245
|
+
process_error(r, result, already_errored)
|
|
284
246
|
end
|
|
285
|
-
result
|
|
247
|
+
return result
|
|
286
248
|
end
|
|
287
249
|
|
|
288
250
|
# @param y [String, nil]
|
|
@@ -291,22 +253,8 @@ module Solargraph
|
|
|
291
253
|
def process_yardoc y, spec = nil
|
|
292
254
|
return [] if y.nil?
|
|
293
255
|
if spec
|
|
294
|
-
|
|
295
|
-
if
|
|
296
|
-
Solargraph.logger.info "Loading #{spec.name} #{spec.version} from cache"
|
|
297
|
-
file = File.open(ser, 'rb')
|
|
298
|
-
dump = file.read
|
|
299
|
-
file.close
|
|
300
|
-
begin
|
|
301
|
-
result = Marshal.load(dump)
|
|
302
|
-
return result unless result.nil? || result.empty?
|
|
303
|
-
Solargraph.logger.warn "Empty cache for #{spec.name} #{spec.version}. Reloading"
|
|
304
|
-
File.unlink ser
|
|
305
|
-
rescue StandardError => e
|
|
306
|
-
Solargraph.logger.warn "Error loading pin cache: [#{e.class}] #{e.message}"
|
|
307
|
-
File.unlink ser
|
|
308
|
-
end
|
|
309
|
-
end
|
|
256
|
+
cache = Solargraph::Cache.load('gems', "#{spec.name}-#{spec.version}.ser")
|
|
257
|
+
return cache if cache
|
|
310
258
|
end
|
|
311
259
|
size = Dir.glob(File.join(y, '**', '*'))
|
|
312
260
|
.map{ |f| File.size(f) }
|
|
@@ -320,10 +268,7 @@ module Solargraph
|
|
|
320
268
|
result = Mapper.new(YARD::Registry.all, spec).map
|
|
321
269
|
raise NoYardocError, "Yardoc at #{y} is empty" if result.empty?
|
|
322
270
|
if spec
|
|
323
|
-
|
|
324
|
-
file = File.open(ser, 'wb')
|
|
325
|
-
file.write Marshal.dump(result)
|
|
326
|
-
file.close
|
|
271
|
+
Solargraph::Cache.save 'gems', "#{spec.name}-#{spec.version}.ser", result
|
|
327
272
|
end
|
|
328
273
|
result
|
|
329
274
|
end
|
|
@@ -331,19 +276,15 @@ module Solargraph
|
|
|
331
276
|
# @param spec [Gem::Specification]
|
|
332
277
|
# @return [String]
|
|
333
278
|
def yardoc_file_for_spec spec
|
|
334
|
-
|
|
335
|
-
if File.exist?(cache_dir)
|
|
336
|
-
Solargraph.logger.info "Using cached documentation for #{spec.name} at #{cache_dir}"
|
|
337
|
-
cache_dir
|
|
338
|
-
else
|
|
339
|
-
YARD::Registry.yardoc_file_for_gem(spec.name, "= #{spec.version}")
|
|
340
|
-
end
|
|
279
|
+
YARD::Registry.yardoc_file_for_gem(spec.name, "= #{spec.version}")
|
|
341
280
|
end
|
|
342
281
|
|
|
343
282
|
# @param path [String]
|
|
344
283
|
# @return [Gem::Specification]
|
|
345
284
|
def spec_for_require path
|
|
346
|
-
|
|
285
|
+
name = path.split('/').first
|
|
286
|
+
spec = Gem::Specification.find_by_name(name, @gemset[name])
|
|
287
|
+
|
|
347
288
|
# Avoid loading the spec again if it's going to be skipped anyway
|
|
348
289
|
return spec if @source_gems.include?(spec.name)
|
|
349
290
|
# Avoid loading the spec again if it's already the correct version
|
|
@@ -356,88 +297,5 @@ module Solargraph
|
|
|
356
297
|
end
|
|
357
298
|
spec
|
|
358
299
|
end
|
|
359
|
-
|
|
360
|
-
def load_core_pins
|
|
361
|
-
yd = CoreDocs.yardoc_file
|
|
362
|
-
ser = File.join(File.dirname(yd), 'core.ser')
|
|
363
|
-
result = if File.file?(ser)
|
|
364
|
-
file = File.open(ser, 'rb')
|
|
365
|
-
dump = file.read
|
|
366
|
-
file.close
|
|
367
|
-
begin
|
|
368
|
-
Marshal.load(dump)
|
|
369
|
-
rescue StandardError => e
|
|
370
|
-
Solargraph.logger.warn "Error loading core pin cache: [#{e.class}] #{e.message}"
|
|
371
|
-
File.unlink ser
|
|
372
|
-
read_core_and_save_cache(yd, ser)
|
|
373
|
-
end
|
|
374
|
-
else
|
|
375
|
-
read_core_and_save_cache(yd, ser)
|
|
376
|
-
end
|
|
377
|
-
ApiMap::Store.new(result + CoreFills::ALL).pins.reject { |pin| pin.is_a?(Pin::Reference::Override) }
|
|
378
|
-
end
|
|
379
|
-
|
|
380
|
-
def read_core_and_save_cache yd, ser
|
|
381
|
-
result = []
|
|
382
|
-
load_yardoc yd
|
|
383
|
-
result.concat Mapper.new(YARD::Registry.all).map
|
|
384
|
-
# HACK: Assume core methods with a single `args` parameter accept restarg
|
|
385
|
-
result.select { |pin| pin.is_a?(Solargraph::Pin::Method )}.each do |pin|
|
|
386
|
-
if pin.parameters.length == 1 && pin.parameters.first.name == 'args' && pin.parameters.first.decl == :arg
|
|
387
|
-
# @todo Smelly instance variable access
|
|
388
|
-
pin.parameters.first.instance_variable_set(:@decl, :restarg)
|
|
389
|
-
end
|
|
390
|
-
end
|
|
391
|
-
# HACK: Set missing parameters on `==` methods, e.g., `Symbol#==`
|
|
392
|
-
result.select { |pin| pin.name == '==' && pin.parameters.empty? }.each do |pin|
|
|
393
|
-
pin.parameters.push Pin::Parameter.new(decl: :arg, name: 'obj2')
|
|
394
|
-
end
|
|
395
|
-
dump = Marshal.dump(result)
|
|
396
|
-
file = File.open(ser, 'wb')
|
|
397
|
-
file.write dump
|
|
398
|
-
file.close
|
|
399
|
-
result
|
|
400
|
-
end
|
|
401
|
-
|
|
402
|
-
def load_stdlib_pins base
|
|
403
|
-
ser = File.join(File.dirname(CoreDocs.yardoc_stdlib_file), "#{base}.ser")
|
|
404
|
-
result = if File.file?(ser)
|
|
405
|
-
Solargraph.logger.info "Loading #{base} stdlib from cache"
|
|
406
|
-
file = File.open(ser, 'rb')
|
|
407
|
-
dump = file.read
|
|
408
|
-
file.close
|
|
409
|
-
begin
|
|
410
|
-
Marshal.load(dump)
|
|
411
|
-
rescue StandardError => e
|
|
412
|
-
Solargraph.logger.warn "Error loading #{base} stdlib pin cache: [#{e.class}] #{e.message}"
|
|
413
|
-
File.unlink ser
|
|
414
|
-
read_stdlib_and_save_cache(base, ser)
|
|
415
|
-
end
|
|
416
|
-
else
|
|
417
|
-
read_stdlib_and_save_cache(base, ser)
|
|
418
|
-
end
|
|
419
|
-
fills = StdlibFills.get(base)
|
|
420
|
-
unless fills.empty?
|
|
421
|
-
result = ApiMap::Store.new(result + fills).pins.reject { |pin| pin.is_a?(Pin::Reference::Override) }
|
|
422
|
-
end
|
|
423
|
-
result
|
|
424
|
-
end
|
|
425
|
-
|
|
426
|
-
def read_stdlib_and_save_cache base, ser
|
|
427
|
-
result = []
|
|
428
|
-
if stdlib_paths[base]
|
|
429
|
-
Solargraph.logger.info "Loading #{base} stdlib from yardoc"
|
|
430
|
-
result.concat Mapper.new(stdlib_paths[base]).map
|
|
431
|
-
unless result.empty?
|
|
432
|
-
dump = Marshal.dump(result)
|
|
433
|
-
file = File.open(ser, 'wb')
|
|
434
|
-
file.write dump
|
|
435
|
-
file.close
|
|
436
|
-
end
|
|
437
|
-
end
|
|
438
|
-
result
|
|
439
|
-
end
|
|
440
300
|
end
|
|
441
301
|
end
|
|
442
|
-
|
|
443
|
-
Solargraph::YardMap::CoreDocs.require_minimum
|
data/lib/solargraph.rb
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Encoding.default_external = 'UTF-8'
|
|
4
4
|
|
|
5
|
-
require 'solargraph/compat'
|
|
6
5
|
require 'solargraph/version'
|
|
7
6
|
|
|
8
7
|
# The top-level namespace for the Solargraph code mapping, documentation,
|
|
@@ -41,9 +40,10 @@ module Solargraph
|
|
|
41
40
|
autoload :Convention, 'solargraph/convention'
|
|
42
41
|
autoload :Documentor, 'solargraph/documentor'
|
|
43
42
|
autoload :Parser, 'solargraph/parser'
|
|
43
|
+
autoload :RbsMap, 'solargraph/rbs_map'
|
|
44
|
+
autoload :Cache, 'solargraph/cache'
|
|
44
45
|
|
|
45
46
|
dir = File.dirname(__FILE__)
|
|
46
|
-
YARDOC_PATH = File.realpath(File.join(dir, '..', 'yardoc'))
|
|
47
47
|
YARD_EXTENSION_FILE = File.join(dir, 'yard-solargraph.rb')
|
|
48
48
|
VIEWS_PATH = File.join(dir, 'solargraph', 'views')
|
|
49
49
|
|
|
@@ -59,8 +59,8 @@ module Solargraph
|
|
|
59
59
|
#
|
|
60
60
|
# @return [void]
|
|
61
61
|
def self.with_clean_env &block
|
|
62
|
-
meth = if Bundler.respond_to?(:
|
|
63
|
-
:
|
|
62
|
+
meth = if Bundler.respond_to?(:with_original_env)
|
|
63
|
+
:with_original_env
|
|
64
64
|
else
|
|
65
65
|
:with_clean_env
|
|
66
66
|
end
|
data/solargraph.gemspec
CHANGED
|
@@ -13,30 +13,32 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
14
14
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
15
15
|
end
|
|
16
|
-
s.homepage = '
|
|
16
|
+
s.homepage = 'https://solargraph.org'
|
|
17
17
|
s.license = 'MIT'
|
|
18
18
|
s.executables = ['solargraph']
|
|
19
|
+
s.metadata["funding_uri"] = "https://www.patreon.com/castwide"
|
|
19
20
|
|
|
20
|
-
s.required_ruby_version = '>= 2.
|
|
21
|
+
s.required_ruby_version = '>= 2.6'
|
|
21
22
|
|
|
22
23
|
s.add_runtime_dependency 'backport', '~> 1.2'
|
|
23
24
|
s.add_runtime_dependency 'benchmark'
|
|
24
|
-
s.add_runtime_dependency 'bundler', '
|
|
25
|
+
s.add_runtime_dependency 'bundler', '~> 2.0'
|
|
25
26
|
s.add_runtime_dependency 'diff-lcs', '~> 1.4'
|
|
26
27
|
s.add_runtime_dependency 'e2mmap'
|
|
27
28
|
s.add_runtime_dependency 'jaro_winkler', '~> 1.5'
|
|
28
29
|
s.add_runtime_dependency 'kramdown', '~> 2.3'
|
|
29
30
|
s.add_runtime_dependency 'kramdown-parser-gfm', '~> 1.1'
|
|
30
31
|
s.add_runtime_dependency 'parser', '~> 3.0'
|
|
31
|
-
s.add_runtime_dependency '
|
|
32
|
-
s.add_runtime_dependency '
|
|
32
|
+
s.add_runtime_dependency 'rbs', '~> 2.0'
|
|
33
|
+
s.add_runtime_dependency 'reverse_markdown', '~> 2.0'
|
|
34
|
+
s.add_runtime_dependency 'rubocop', '~> 1.38'
|
|
33
35
|
s.add_runtime_dependency 'thor', '~> 1.0'
|
|
34
36
|
s.add_runtime_dependency 'tilt', '~> 2.0'
|
|
35
37
|
s.add_runtime_dependency 'yard', '~> 0.9', '>= 0.9.24'
|
|
36
38
|
|
|
37
39
|
s.add_development_dependency 'pry'
|
|
38
40
|
s.add_development_dependency 'public_suffix', '~> 3.1'
|
|
39
|
-
s.add_development_dependency 'rspec', '~> 3.5'
|
|
41
|
+
s.add_development_dependency 'rspec', '~> 3.5'
|
|
40
42
|
s.add_development_dependency 'simplecov', '~> 0.14'
|
|
41
43
|
s.add_development_dependency 'webmock', '~> 3.6'
|
|
42
44
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solargraph
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.49.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fred Snyder
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-04-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: backport
|
|
@@ -42,16 +42,16 @@ dependencies:
|
|
|
42
42
|
name: bundler
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - "
|
|
45
|
+
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
47
|
+
version: '2.0'
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- - "
|
|
52
|
+
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
54
|
+
version: '2.0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: diff-lcs
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -137,39 +137,47 @@ dependencies:
|
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '3.0'
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
|
-
name:
|
|
140
|
+
name: rbs
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
142
142
|
requirements:
|
|
143
|
-
- - "
|
|
144
|
-
- !ruby/object:Gem::Version
|
|
145
|
-
version: 1.0.5
|
|
146
|
-
- - "<"
|
|
143
|
+
- - "~>"
|
|
147
144
|
- !ruby/object:Gem::Version
|
|
148
|
-
version: '
|
|
145
|
+
version: '2.0'
|
|
149
146
|
type: :runtime
|
|
150
147
|
prerelease: false
|
|
151
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
152
149
|
requirements:
|
|
153
|
-
- - "
|
|
150
|
+
- - "~>"
|
|
154
151
|
- !ruby/object:Gem::Version
|
|
155
|
-
version:
|
|
156
|
-
|
|
152
|
+
version: '2.0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: reverse_markdown
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - "~>"
|
|
157
158
|
- !ruby/object:Gem::Version
|
|
158
|
-
version: '
|
|
159
|
+
version: '2.0'
|
|
160
|
+
type: :runtime
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - "~>"
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '2.0'
|
|
159
167
|
- !ruby/object:Gem::Dependency
|
|
160
168
|
name: rubocop
|
|
161
169
|
requirement: !ruby/object:Gem::Requirement
|
|
162
170
|
requirements:
|
|
163
|
-
- - "
|
|
171
|
+
- - "~>"
|
|
164
172
|
- !ruby/object:Gem::Version
|
|
165
|
-
version: '
|
|
173
|
+
version: '1.38'
|
|
166
174
|
type: :runtime
|
|
167
175
|
prerelease: false
|
|
168
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
169
177
|
requirements:
|
|
170
|
-
- - "
|
|
178
|
+
- - "~>"
|
|
171
179
|
- !ruby/object:Gem::Version
|
|
172
|
-
version: '
|
|
180
|
+
version: '1.38'
|
|
173
181
|
- !ruby/object:Gem::Dependency
|
|
174
182
|
name: thor
|
|
175
183
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -253,9 +261,6 @@ dependencies:
|
|
|
253
261
|
- - "~>"
|
|
254
262
|
- !ruby/object:Gem::Version
|
|
255
263
|
version: '3.5'
|
|
256
|
-
- - ">="
|
|
257
|
-
- !ruby/object:Gem::Version
|
|
258
|
-
version: 3.5.0
|
|
259
264
|
type: :development
|
|
260
265
|
prerelease: false
|
|
261
266
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -263,9 +268,6 @@ dependencies:
|
|
|
263
268
|
- - "~>"
|
|
264
269
|
- !ruby/object:Gem::Version
|
|
265
270
|
version: '3.5'
|
|
266
|
-
- - ">="
|
|
267
|
-
- !ruby/object:Gem::Version
|
|
268
|
-
version: 3.5.0
|
|
269
271
|
- !ruby/object:Gem::Dependency
|
|
270
272
|
name: simplecov
|
|
271
273
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -301,6 +303,8 @@ executables:
|
|
|
301
303
|
extensions: []
|
|
302
304
|
extra_rdoc_files: []
|
|
303
305
|
files:
|
|
306
|
+
- ".github/FUNDING.yml"
|
|
307
|
+
- ".github/workflows/rspec.yml"
|
|
304
308
|
- ".gitignore"
|
|
305
309
|
- ".rspec"
|
|
306
310
|
- ".travis.yml"
|
|
@@ -320,7 +324,7 @@ files:
|
|
|
320
324
|
- lib/solargraph/api_map/source_to_yard.rb
|
|
321
325
|
- lib/solargraph/api_map/store.rb
|
|
322
326
|
- lib/solargraph/bench.rb
|
|
323
|
-
- lib/solargraph/
|
|
327
|
+
- lib/solargraph/cache.rb
|
|
324
328
|
- lib/solargraph/complex_type.rb
|
|
325
329
|
- lib/solargraph/complex_type/type_methods.rb
|
|
326
330
|
- lib/solargraph/complex_type/unique_type.rb
|
|
@@ -328,6 +332,7 @@ files:
|
|
|
328
332
|
- lib/solargraph/convention/base.rb
|
|
329
333
|
- lib/solargraph/convention/gemfile.rb
|
|
330
334
|
- lib/solargraph/convention/gemspec.rb
|
|
335
|
+
- lib/solargraph/convention/rakefile.rb
|
|
331
336
|
- lib/solargraph/convention/rspec.rb
|
|
332
337
|
- lib/solargraph/converters/dd.rb
|
|
333
338
|
- lib/solargraph/converters/dl.rb
|
|
@@ -462,6 +467,7 @@ files:
|
|
|
462
467
|
- lib/solargraph/parser/rubyvm/node_processors/scope_node.rb
|
|
463
468
|
- lib/solargraph/parser/rubyvm/node_processors/send_node.rb
|
|
464
469
|
- lib/solargraph/parser/rubyvm/node_processors/sym_node.rb
|
|
470
|
+
- lib/solargraph/parser/rubyvm/node_wrapper.rb
|
|
465
471
|
- lib/solargraph/parser/snippet.rb
|
|
466
472
|
- lib/solargraph/pin.rb
|
|
467
473
|
- lib/solargraph/pin/base.rb
|
|
@@ -491,10 +497,18 @@ files:
|
|
|
491
497
|
- lib/solargraph/pin/reference/prepend.rb
|
|
492
498
|
- lib/solargraph/pin/reference/require.rb
|
|
493
499
|
- lib/solargraph/pin/reference/superclass.rb
|
|
500
|
+
- lib/solargraph/pin/search.rb
|
|
501
|
+
- lib/solargraph/pin/signature.rb
|
|
494
502
|
- lib/solargraph/pin/singleton.rb
|
|
495
503
|
- lib/solargraph/pin/symbol.rb
|
|
496
504
|
- lib/solargraph/position.rb
|
|
497
505
|
- lib/solargraph/range.rb
|
|
506
|
+
- lib/solargraph/rbs_map.rb
|
|
507
|
+
- lib/solargraph/rbs_map/conversions.rb
|
|
508
|
+
- lib/solargraph/rbs_map/core_fills.rb
|
|
509
|
+
- lib/solargraph/rbs_map/core_map.rb
|
|
510
|
+
- lib/solargraph/rbs_map/core_signs.rb
|
|
511
|
+
- lib/solargraph/rbs_map/stdlib_map.rb
|
|
498
512
|
- lib/solargraph/server_methods.rb
|
|
499
513
|
- lib/solargraph/shell.rb
|
|
500
514
|
- lib/solargraph/source.rb
|
|
@@ -539,24 +553,19 @@ files:
|
|
|
539
553
|
- lib/solargraph/workspace/config.rb
|
|
540
554
|
- lib/solargraph/yard_map.rb
|
|
541
555
|
- lib/solargraph/yard_map/cache.rb
|
|
542
|
-
- lib/solargraph/yard_map/core_docs.rb
|
|
543
|
-
- lib/solargraph/yard_map/core_fills.rb
|
|
544
|
-
- lib/solargraph/yard_map/core_gen.rb
|
|
545
556
|
- lib/solargraph/yard_map/helpers.rb
|
|
546
557
|
- lib/solargraph/yard_map/mapper.rb
|
|
547
558
|
- lib/solargraph/yard_map/mapper/to_constant.rb
|
|
548
559
|
- lib/solargraph/yard_map/mapper/to_method.rb
|
|
549
560
|
- lib/solargraph/yard_map/mapper/to_namespace.rb
|
|
550
|
-
- lib/solargraph/yard_map/rdoc_to_yard.rb
|
|
551
|
-
- lib/solargraph/yard_map/stdlib_fills.rb
|
|
552
561
|
- lib/solargraph/yard_map/to_method.rb
|
|
553
562
|
- lib/yard-solargraph.rb
|
|
554
563
|
- solargraph.gemspec
|
|
555
|
-
|
|
556
|
-
homepage: http://solargraph.org
|
|
564
|
+
homepage: https://solargraph.org
|
|
557
565
|
licenses:
|
|
558
566
|
- MIT
|
|
559
|
-
metadata:
|
|
567
|
+
metadata:
|
|
568
|
+
funding_uri: https://www.patreon.com/castwide
|
|
560
569
|
post_install_message:
|
|
561
570
|
rdoc_options: []
|
|
562
571
|
require_paths:
|
|
@@ -565,14 +574,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
565
574
|
requirements:
|
|
566
575
|
- - ">="
|
|
567
576
|
- !ruby/object:Gem::Version
|
|
568
|
-
version: '2.
|
|
577
|
+
version: '2.6'
|
|
569
578
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
570
579
|
requirements:
|
|
571
580
|
- - ">="
|
|
572
581
|
- !ruby/object:Gem::Version
|
|
573
582
|
version: '0'
|
|
574
583
|
requirements: []
|
|
575
|
-
rubygems_version: 3.
|
|
584
|
+
rubygems_version: 3.3.7
|
|
576
585
|
signing_key:
|
|
577
586
|
specification_version: 4
|
|
578
587
|
summary: A Ruby language server
|
data/lib/solargraph/compat.rb
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
unless Hash.method_defined?(:transform_keys)
|
|
2
|
-
class Hash
|
|
3
|
-
def transform_keys &block
|
|
4
|
-
result = {}
|
|
5
|
-
each_pair do |k, v|
|
|
6
|
-
result[block.call(k)] = v
|
|
7
|
-
end
|
|
8
|
-
result
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
unless Hash.method_defined?(:transform_values)
|
|
14
|
-
class Hash
|
|
15
|
-
def transform_values &block
|
|
16
|
-
result = {}
|
|
17
|
-
each_pair do |k, v|
|
|
18
|
-
result[k] = block.call(v)
|
|
19
|
-
end
|
|
20
|
-
result
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
unless Array.method_defined?(:sum)
|
|
26
|
-
class Array
|
|
27
|
-
def sum &block
|
|
28
|
-
inject(0) do |s, x|
|
|
29
|
-
if block
|
|
30
|
-
s + block.call(x)
|
|
31
|
-
else
|
|
32
|
-
s + x
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|