solargraph 0.39.14 → 0.40.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -8
- data/CHANGELOG.md +988 -0
- data/Rakefile +12 -1
- data/SPONSORS.md +1 -0
- data/lib/solargraph.rb +2 -4
- data/lib/solargraph/api_map.rb +75 -74
- data/lib/solargraph/api_map/cache.rb +2 -2
- data/lib/solargraph/api_map/store.rb +4 -8
- data/lib/solargraph/{bundle.rb → bench.rb} +6 -2
- data/lib/solargraph/compat.rb +14 -0
- data/lib/solargraph/complex_type.rb +2 -2
- data/lib/solargraph/convention.rb +13 -4
- data/lib/solargraph/convention/base.rb +16 -8
- data/lib/solargraph/convention/gemfile.rb +2 -5
- data/lib/solargraph/convention/gemspec.rb +3 -6
- data/lib/solargraph/convention/rspec.rb +3 -6
- data/lib/solargraph/documentor.rb +2 -0
- data/lib/solargraph/environ.rb +11 -6
- data/lib/solargraph/language_server/message/extended/check_gem_version.rb +6 -1
- data/lib/solargraph/language_server/message/text_document/definition.rb +1 -1
- data/lib/solargraph/language_server/message/text_document/formatting.rb +17 -19
- data/lib/solargraph/library.rb +8 -10
- data/lib/solargraph/parser/legacy/node_chainer.rb +7 -7
- data/lib/solargraph/parser/legacy/node_methods.rb +5 -0
- data/lib/solargraph/parser/legacy/node_processors/ivasgn_node.rb +1 -1
- data/lib/solargraph/parser/legacy/node_processors/send_node.rb +36 -23
- data/lib/solargraph/parser/node_processor/base.rb +3 -0
- data/lib/solargraph/parser/rubyvm/node_chainer.rb +9 -9
- data/lib/solargraph/parser/rubyvm/node_methods.rb +11 -1
- data/lib/solargraph/parser/rubyvm/node_processors/args_node.rb +1 -1
- data/lib/solargraph/parser/rubyvm/node_processors/ivasgn_node.rb +1 -1
- data/lib/solargraph/parser/rubyvm/node_processors/send_node.rb +40 -29
- data/lib/solargraph/pin.rb +0 -3
- data/lib/solargraph/pin/common.rb +1 -1
- data/lib/solargraph/pin/conversions.rb +3 -4
- data/lib/solargraph/pin/documenting.rb +3 -9
- data/lib/solargraph/pin/method.rb +141 -7
- data/lib/solargraph/pin/method_alias.rb +1 -1
- data/lib/solargraph/position.rb +2 -14
- data/lib/solargraph/shell.rb +1 -1
- data/lib/solargraph/source.rb +10 -6
- data/lib/solargraph/source/chain.rb +18 -5
- data/lib/solargraph/source_map.rb +4 -1
- data/lib/solargraph/source_map/clip.rb +3 -2
- data/lib/solargraph/source_map/mapper.rb +10 -6
- data/lib/solargraph/type_checker.rb +35 -39
- data/lib/solargraph/type_checker/param_def.rb +1 -1
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/yard_map.rb +40 -47
- data/lib/solargraph/yard_map/core_fills.rb +185 -0
- data/lib/solargraph/yard_map/helpers.rb +16 -0
- data/lib/solargraph/yard_map/mapper.rb +14 -8
- data/lib/solargraph/{pin/yard_pin/constant.rb → yard_map/mapper/to_constant.rb} +6 -6
- data/lib/solargraph/yard_map/mapper/to_method.rb +78 -0
- data/lib/solargraph/{pin/yard_pin/namespace.rb → yard_map/mapper/to_namespace.rb} +6 -6
- data/lib/solargraph/yard_map/rdoc_to_yard.rb +1 -1
- data/lib/solargraph/yard_map/stdlib_fills.rb +43 -0
- data/lib/solargraph/yard_map/to_method.rb +79 -0
- data/solargraph.gemspec +4 -4
- metadata +20 -34
- data/lib/solargraph/core_fills.rb +0 -160
- data/lib/solargraph/pin/attribute.rb +0 -49
- data/lib/solargraph/pin/base_method.rb +0 -141
- data/lib/solargraph/pin/yard_pin.rb +0 -12
- data/lib/solargraph/pin/yard_pin/method.rb +0 -80
- data/lib/solargraph/pin/yard_pin/yard_mixin.rb +0 -20
- data/lib/solargraph/stdlib_fills.rb +0 -40
- data/travis-bundler.rb +0 -11
data/Rakefile
CHANGED
@@ -11,4 +11,15 @@ end
|
|
11
11
|
desc "Open a Pry session preloaded with this library"
|
12
12
|
task :console do
|
13
13
|
sh "pry -I lib -r solargraph.rb"
|
14
|
-
end
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Run the type checker"
|
17
|
+
task :typecheck do
|
18
|
+
sh "bundle exec solargraph typecheck --level typed"
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Run all tests"
|
22
|
+
task :test do
|
23
|
+
Rake::Task["typecheck"].invoke
|
24
|
+
Rake::Task["spec"].invoke
|
25
|
+
end
|
data/SPONSORS.md
CHANGED
data/lib/solargraph.rb
CHANGED
@@ -27,15 +27,13 @@ module Solargraph
|
|
27
27
|
autoload :YardMap, 'solargraph/yard_map'
|
28
28
|
autoload :Pin, 'solargraph/pin'
|
29
29
|
autoload :ServerMethods, 'solargraph/server_methods'
|
30
|
-
autoload :CoreFills, 'solargraph/core_fills'
|
31
|
-
autoload :StdlibFills, 'solargraph/stdlib_fills'
|
32
30
|
autoload :LanguageServer, 'solargraph/language_server'
|
33
31
|
autoload :Workspace, 'solargraph/workspace'
|
34
32
|
autoload :Page, 'solargraph/page'
|
35
33
|
autoload :Library, 'solargraph/library'
|
36
34
|
autoload :Diagnostics, 'solargraph/diagnostics'
|
37
35
|
autoload :ComplexType, 'solargraph/complex_type'
|
38
|
-
autoload :
|
36
|
+
autoload :Bench, 'solargraph/bench'
|
39
37
|
autoload :Logging, 'solargraph/logging'
|
40
38
|
autoload :TypeChecker, 'solargraph/type_checker'
|
41
39
|
autoload :Environ, 'solargraph/environ'
|
@@ -56,7 +54,7 @@ module Solargraph
|
|
56
54
|
end
|
57
55
|
|
58
56
|
# A helper method that runs Bundler.with_unbundled_env or falls back to
|
59
|
-
# Bundler.
|
57
|
+
# Bundler.with_clean_env for earlier versions of Bundler.
|
60
58
|
#
|
61
59
|
def self.with_clean_env &block
|
62
60
|
meth = if Bundler.respond_to?(:with_unbundled_env)
|
data/lib/solargraph/api_map.rb
CHANGED
@@ -33,11 +33,7 @@ module Solargraph
|
|
33
33
|
# @param pins [Array<Pin::Base>]
|
34
34
|
# @return [self]
|
35
35
|
def index pins
|
36
|
-
|
37
|
-
@cache.clear
|
38
|
-
@store = Store.new(pins + YardMap.new.pins)
|
39
|
-
@unresolved_requires = []
|
40
|
-
workspace_filenames.clear
|
36
|
+
catalog Bench.new(pins: pins)
|
41
37
|
self
|
42
38
|
end
|
43
39
|
|
@@ -46,7 +42,7 @@ module Solargraph
|
|
46
42
|
# @param source [Source]
|
47
43
|
# @return [self]
|
48
44
|
def map source
|
49
|
-
catalog
|
45
|
+
catalog Bench.new(opened: [source])
|
50
46
|
self
|
51
47
|
end
|
52
48
|
|
@@ -56,17 +52,19 @@ module Solargraph
|
|
56
52
|
store.named_macros[name]
|
57
53
|
end
|
58
54
|
|
59
|
-
# Catalog a
|
55
|
+
# Catalog a bench.
|
60
56
|
#
|
61
|
-
# @param
|
57
|
+
# @param bench [Bench]
|
62
58
|
# @return [self]
|
63
|
-
def catalog
|
59
|
+
def catalog bench
|
64
60
|
new_map_hash = {}
|
65
|
-
#
|
66
|
-
merged = (
|
67
|
-
|
61
|
+
# Bench always needs to be merged if it adds or removes sources
|
62
|
+
merged = (bench.sources.length == source_map_hash.values.length)
|
63
|
+
bench.sources.each do |source|
|
68
64
|
if source_map_hash.key?(source.filename)
|
69
|
-
if source_map_hash[source.filename].code == source.code &&
|
65
|
+
if source_map_hash[source.filename].code == source.code &&
|
66
|
+
source_map_hash[source.filename].source.synchronized? &&
|
67
|
+
source.synchronized?
|
70
68
|
new_map_hash[source.filename] = source_map_hash[source.filename]
|
71
69
|
elsif !source.synchronized?
|
72
70
|
new_map_hash[source.filename] = source_map_hash[source.filename]
|
@@ -87,23 +85,28 @@ module Solargraph
|
|
87
85
|
merged = false
|
88
86
|
end
|
89
87
|
end
|
90
|
-
return self if merged
|
88
|
+
return self if bench.pins.empty? && @store && merged
|
91
89
|
implicit.clear
|
92
90
|
pins = []
|
93
91
|
reqs = Set.new
|
94
92
|
# @param map [SourceMap]
|
95
|
-
new_map_hash.
|
96
|
-
implicit.merge map.environ
|
93
|
+
new_map_hash.each_value do |map|
|
97
94
|
pins.concat map.pins
|
98
95
|
reqs.merge map.requires.map(&:name)
|
99
96
|
end
|
100
|
-
|
97
|
+
pins.concat bench.pins
|
98
|
+
reqs.merge bench.workspace.config.required
|
99
|
+
@required = reqs
|
100
|
+
bench.sources.each do |src|
|
101
|
+
implicit.merge new_map_hash[src.filename].environ
|
102
|
+
end
|
103
|
+
# implicit.merge Convention.for_global(self)
|
101
104
|
local_path_hash.clear
|
102
|
-
unless
|
105
|
+
unless bench.workspace.require_paths.empty?
|
103
106
|
file_keys = new_map_hash.keys
|
104
|
-
workspace_path = Pathname.new(
|
107
|
+
workspace_path = Pathname.new(bench.workspace.directory)
|
105
108
|
reqs.delete_if do |r|
|
106
|
-
|
109
|
+
bench.workspace.require_paths.any? do |base|
|
107
110
|
pn = workspace_path.join(base, "#{r}.rb").to_s
|
108
111
|
if file_keys.include? pn
|
109
112
|
local_path_hash[r] = pn
|
@@ -115,22 +118,25 @@ module Solargraph
|
|
115
118
|
end
|
116
119
|
end
|
117
120
|
reqs.merge implicit.requires
|
118
|
-
|
119
|
-
br = reqs.include?('bundler/require') ? require_from_bundle(bundle.workspace.directory) : {}
|
121
|
+
br = reqs.include?('bundler/require') ? require_from_bundle(bench.workspace.directory) : {}
|
120
122
|
reqs.merge br.keys
|
121
|
-
yard_map.change(reqs.to_a, br,
|
122
|
-
new_store = Store.new(pins +
|
123
|
+
yard_map.change(reqs.to_a, br, bench.workspace.gemnames)
|
124
|
+
new_store = Store.new(yard_map.pins + implicit.pins + pins)
|
123
125
|
@cache.clear
|
124
126
|
@source_map_hash = new_map_hash
|
125
127
|
@store = new_store
|
126
128
|
@unresolved_requires = yard_map.unresolved_requires
|
127
129
|
workspace_filenames.clear
|
128
|
-
workspace_filenames.concat
|
130
|
+
workspace_filenames.concat bench.workspace.filenames
|
129
131
|
@rebindable_method_names = nil
|
130
132
|
store.block_pins.each { |blk| blk.rebind(self) }
|
131
133
|
self
|
132
134
|
end
|
133
135
|
|
136
|
+
def required
|
137
|
+
@required ||= Set.new
|
138
|
+
end
|
139
|
+
|
134
140
|
# @return [Environ]
|
135
141
|
def implicit
|
136
142
|
@implicit ||= Environ.new
|
@@ -146,7 +152,7 @@ module Solargraph
|
|
146
152
|
# @return [Source::Cursor]
|
147
153
|
def cursor_at filename, position
|
148
154
|
position = Position.normalize(position)
|
149
|
-
raise FileNotFoundError, "File not found: #{filename}" unless source_map_hash.
|
155
|
+
raise FileNotFoundError, "File not found: #{filename}" unless source_map_hash.key?(filename)
|
150
156
|
source_map_hash[filename].cursor_at(position)
|
151
157
|
end
|
152
158
|
|
@@ -165,9 +171,9 @@ module Solargraph
|
|
165
171
|
# @param directory [String]
|
166
172
|
# @return [ApiMap]
|
167
173
|
def self.load directory
|
168
|
-
api_map =
|
174
|
+
api_map = new
|
169
175
|
workspace = Solargraph::Workspace.new(directory)
|
170
|
-
api_map.catalog
|
176
|
+
api_map.catalog Bench.new(workspace: workspace)
|
171
177
|
api_map
|
172
178
|
end
|
173
179
|
|
@@ -189,10 +195,8 @@ module Solargraph
|
|
189
195
|
# An array of pins based on Ruby keywords (`if`, `end`, etc.).
|
190
196
|
#
|
191
197
|
# @return [Array<Solargraph::Pin::Keyword>]
|
192
|
-
def
|
193
|
-
|
194
|
-
Pin::Keyword.new(s)
|
195
|
-
}.freeze
|
198
|
+
def keyword_pins
|
199
|
+
store.pins_by_class(Pin::Keyword)
|
196
200
|
end
|
197
201
|
|
198
202
|
# An array of namespace names defined in the ApiMap.
|
@@ -296,7 +300,7 @@ module Solargraph
|
|
296
300
|
# @param scope [Symbol] :class or :instance
|
297
301
|
# @param visibility [Array<Symbol>] :public, :protected, and/or :private
|
298
302
|
# @param deep [Boolean] True to include superclasses, mixins, etc.
|
299
|
-
# @return [Array<Solargraph::Pin::
|
303
|
+
# @return [Array<Solargraph::Pin::Method>]
|
300
304
|
def get_methods fqns, scope: :instance, visibility: [:public], deep: true
|
301
305
|
cached = cache.get_methods(fqns, scope, visibility, deep)
|
302
306
|
return cached.clone unless cached.nil?
|
@@ -373,9 +377,9 @@ module Solargraph
|
|
373
377
|
# @param fqns [String]
|
374
378
|
# @param name [String]
|
375
379
|
# @param scope [Symbol] :instance or :class
|
376
|
-
# @return [Array<Solargraph::Pin::
|
380
|
+
# @return [Array<Solargraph::Pin::Method>]
|
377
381
|
def get_method_stack fqns, name, scope: :instance
|
378
|
-
get_methods(fqns, scope: scope, visibility: [:private, :protected, :public]).select{|p| p.name == name}
|
382
|
+
get_methods(fqns, scope: scope, visibility: [:private, :protected, :public]).select { |p| p.name == name }
|
379
383
|
end
|
380
384
|
|
381
385
|
# Get an array of all suggestions that match the specified path.
|
@@ -386,9 +390,7 @@ module Solargraph
|
|
386
390
|
# @return [Array<Solargraph::Pin::Base>]
|
387
391
|
def get_path_suggestions path
|
388
392
|
return [] if path.nil?
|
389
|
-
|
390
|
-
result.concat store.get_path_pins(path)
|
391
|
-
resolve_method_aliases(result)
|
393
|
+
resolve_method_aliases store.get_path_pins(path)
|
392
394
|
end
|
393
395
|
|
394
396
|
# Get an array of pins that match the specified path.
|
@@ -410,8 +412,9 @@ module Solargraph
|
|
410
412
|
rake_yard(store)
|
411
413
|
found = []
|
412
414
|
code_object_paths.each do |k|
|
413
|
-
if found.empty? || (query.include?('.') || query.include?('#')) || !(k.include?('.') || k.include?('#'))
|
414
|
-
|
415
|
+
if (found.empty? || (query.include?('.') || query.include?('#')) || !(k.include?('.') || k.include?('#'))) &&
|
416
|
+
k.downcase.include?(query.downcase)
|
417
|
+
found.push k
|
415
418
|
end
|
416
419
|
end
|
417
420
|
found
|
@@ -437,24 +440,22 @@ module Solargraph
|
|
437
440
|
# @return [Array<Pin::Base>]
|
438
441
|
def query_symbols query
|
439
442
|
result = []
|
440
|
-
source_map_hash.
|
441
|
-
result.concat s.query_symbols(query)
|
442
|
-
end
|
443
|
+
source_map_hash.each_value { |s| result.concat s.query_symbols(query) }
|
443
444
|
result
|
444
445
|
end
|
445
446
|
|
446
447
|
# @param location [Solargraph::Location]
|
447
448
|
# @return [Array<Solargraph::Pin::Base>]
|
448
449
|
def locate_pins location
|
449
|
-
return [] if location.nil? || !source_map_hash.
|
450
|
-
source_map_hash[location.filename].locate_pins(location)
|
450
|
+
return [] if location.nil? || !source_map_hash.key?(location.filename)
|
451
|
+
resolve_method_aliases source_map_hash[location.filename].locate_pins(location)
|
451
452
|
end
|
452
453
|
|
453
454
|
# @raise [FileNotFoundError] if the cursor's file is not in the ApiMap
|
454
455
|
# @param cursor [Source::Cursor]
|
455
456
|
# @return [SourceMap::Clip]
|
456
457
|
def clip cursor
|
457
|
-
raise FileNotFoundError, "ApiMap did not catalog #{cursor.filename}" unless source_map_hash.
|
458
|
+
raise FileNotFoundError, "ApiMap did not catalog #{cursor.filename}" unless source_map_hash.key?(cursor.filename)
|
458
459
|
SourceMap::Clip.new(self, cursor)
|
459
460
|
end
|
460
461
|
|
@@ -463,8 +464,8 @@ module Solargraph
|
|
463
464
|
# @param filename [String]
|
464
465
|
# @return [Array<Pin::Symbol>]
|
465
466
|
def document_symbols filename
|
466
|
-
return [] unless source_map_hash.
|
467
|
-
source_map_hash[filename].document_symbols
|
467
|
+
return [] unless source_map_hash.key?(filename) # @todo Raise error?
|
468
|
+
resolve_method_aliases source_map_hash[filename].document_symbols
|
468
469
|
end
|
469
470
|
|
470
471
|
# @return [Array<SourceMap>]
|
@@ -477,7 +478,7 @@ module Solargraph
|
|
477
478
|
# @param filename [String]
|
478
479
|
# @return [SourceMap]
|
479
480
|
def source_map filename
|
480
|
-
raise FileNotFoundError, "Source map for `#{filename}` not found" unless source_map_hash.
|
481
|
+
raise FileNotFoundError, "Source map for `#{filename}` not found" unless source_map_hash.key?(filename)
|
481
482
|
source_map_hash[filename]
|
482
483
|
end
|
483
484
|
|
@@ -500,7 +501,7 @@ module Solargraph
|
|
500
501
|
# @return [Location]
|
501
502
|
def require_reference_at location
|
502
503
|
map = source_map(location.filename)
|
503
|
-
pin = map.requires.select { |
|
504
|
+
pin = map.requires.select { |p| p.location.range.contain?(location.range.start) }.first
|
504
505
|
return nil if pin.nil?
|
505
506
|
if local_path_hash.key?(pin.name)
|
506
507
|
return Location.new(local_path_hash[pin.name], Solargraph::Range.from_to(0, 0, 0, 0))
|
@@ -525,6 +526,11 @@ module Solargraph
|
|
525
526
|
false
|
526
527
|
end
|
527
528
|
|
529
|
+
# @return [YardMap]
|
530
|
+
def yard_map
|
531
|
+
@yard_map ||= YardMap.new
|
532
|
+
end
|
533
|
+
|
528
534
|
private
|
529
535
|
|
530
536
|
# @return [Array<String>]
|
@@ -532,27 +538,16 @@ module Solargraph
|
|
532
538
|
@workspace_filenames ||= []
|
533
539
|
end
|
534
540
|
|
535
|
-
# @return [YardMap]
|
536
|
-
def yard_map
|
537
|
-
@yard_map ||= YardMap.new
|
538
|
-
end
|
539
|
-
|
540
541
|
# A hash of source maps with filename keys.
|
541
542
|
#
|
542
543
|
# @return [Hash{String => SourceMap}]
|
543
|
-
|
544
|
-
@source_map_hash
|
545
|
-
end
|
544
|
+
attr_reader :source_map_hash
|
546
545
|
|
547
546
|
# @return [ApiMap::Store]
|
548
|
-
|
549
|
-
@store
|
550
|
-
end
|
547
|
+
attr_reader :store
|
551
548
|
|
552
549
|
# @return [Solargraph::ApiMap::Cache]
|
553
|
-
|
554
|
-
@cache
|
555
|
-
end
|
550
|
+
attr_reader :cache
|
556
551
|
|
557
552
|
# @param fqns [String] A fully qualified namespace
|
558
553
|
# @param scope [Symbol] :class or :instance
|
@@ -659,6 +654,7 @@ module Solargraph
|
|
659
654
|
return nil if name.nil?
|
660
655
|
return nil if skip.include?(root)
|
661
656
|
skip.add root
|
657
|
+
possibles = []
|
662
658
|
if name == ''
|
663
659
|
if root == ''
|
664
660
|
return ''
|
@@ -674,16 +670,19 @@ module Solargraph
|
|
674
670
|
incs = store.get_includes(roots.join('::'))
|
675
671
|
incs.each do |inc|
|
676
672
|
foundinc = inner_qualify(name, inc, skip)
|
677
|
-
|
673
|
+
possibles.push foundinc unless foundinc.nil?
|
678
674
|
end
|
679
675
|
roots.pop
|
680
676
|
end
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
677
|
+
if possibles.empty?
|
678
|
+
incs = store.get_includes('')
|
679
|
+
incs.each do |inc|
|
680
|
+
foundinc = inner_qualify(name, inc, skip)
|
681
|
+
possibles.push foundinc unless foundinc.nil?
|
682
|
+
end
|
685
683
|
end
|
686
684
|
return name if store.namespace_exists?(name)
|
685
|
+
return possibles.last
|
687
686
|
end
|
688
687
|
end
|
689
688
|
|
@@ -723,29 +722,31 @@ module Solargraph
|
|
723
722
|
result = []
|
724
723
|
pins.each do |pin|
|
725
724
|
resolved = resolve_method_alias(pin)
|
726
|
-
next
|
725
|
+
next if resolved.respond_to?(:visibility) && !visibility.include?(resolved.visibility)
|
727
726
|
result.push resolved
|
728
727
|
end
|
729
728
|
result
|
730
729
|
end
|
731
730
|
|
732
731
|
# @param pin [Pin::MethodAlias, Pin::Base]
|
733
|
-
# @return [Pin::
|
732
|
+
# @return [Pin::Method]
|
734
733
|
def resolve_method_alias pin
|
735
734
|
return pin if !pin.is_a?(Pin::MethodAlias) || @method_alias_stack.include?(pin.path)
|
736
735
|
@method_alias_stack.push pin.path
|
737
736
|
origin = get_method_stack(pin.full_context.namespace, pin.original, scope: pin.scope).first
|
738
737
|
@method_alias_stack.pop
|
739
738
|
return pin if origin.nil?
|
740
|
-
|
739
|
+
args = {
|
741
740
|
location: pin.location,
|
742
741
|
closure: pin.closure,
|
743
742
|
name: pin.name,
|
744
743
|
comments: origin.comments,
|
745
744
|
scope: origin.scope,
|
746
745
|
visibility: origin.visibility,
|
747
|
-
parameters: origin.parameters
|
748
|
-
|
746
|
+
parameters: origin.parameters,
|
747
|
+
attribute: origin.attribute?
|
748
|
+
}
|
749
|
+
Pin::Method.new **args
|
749
750
|
end
|
750
751
|
end
|
751
752
|
end
|
@@ -10,7 +10,7 @@ module Solargraph
|
|
10
10
|
@receiver_definitions = {}
|
11
11
|
end
|
12
12
|
|
13
|
-
# @return [Array<Pin::
|
13
|
+
# @return [Array<Pin::Method>]
|
14
14
|
def get_methods fqns, scope, visibility, deep
|
15
15
|
@methods[[fqns, scope, visibility.sort, deep]]
|
16
16
|
end
|
@@ -41,7 +41,7 @@ module Solargraph
|
|
41
41
|
@receiver_definitions.key? path
|
42
42
|
end
|
43
43
|
|
44
|
-
# @return [Pin::
|
44
|
+
# @return [Pin::Method]
|
45
45
|
def get_receiver_definition path
|
46
46
|
@receiver_definitions[path]
|
47
47
|
end
|
@@ -29,7 +29,7 @@ module Solargraph
|
|
29
29
|
# @return [Array<Solargraph::Pin::Base>]
|
30
30
|
def get_methods fqns, scope: :instance, visibility: [:public]
|
31
31
|
namespace_children(fqns).select do |pin|
|
32
|
-
pin.is_a?(Pin::
|
32
|
+
pin.is_a?(Pin::Method) && pin.scope == scope && visibility.include?(pin.visibility)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -102,9 +102,9 @@ module Solargraph
|
|
102
102
|
pins_by_class(Solargraph::Pin::Namespace)
|
103
103
|
end
|
104
104
|
|
105
|
-
# @return [Array<Solargraph::Pin::
|
105
|
+
# @return [Array<Solargraph::Pin::Method>]
|
106
106
|
def method_pins
|
107
|
-
pins_by_class(Solargraph::Pin::
|
107
|
+
pins_by_class(Solargraph::Pin::Method)
|
108
108
|
end
|
109
109
|
|
110
110
|
# @param fqns [String]
|
@@ -218,7 +218,7 @@ module Solargraph
|
|
218
218
|
@pin_select_cache = {}
|
219
219
|
@namespace_map = set.classify(&:namespace).transform_values(&:to_a)
|
220
220
|
@path_pin_hash = set.classify(&:path).transform_values(&:to_a)
|
221
|
-
@namespaces = @path_pin_hash.keys.compact
|
221
|
+
@namespaces = @path_pin_hash.keys.compact.to_set
|
222
222
|
pins_by_class(Pin::Reference::Include).each do |pin|
|
223
223
|
include_references[pin.namespace] ||= []
|
224
224
|
include_references[pin.namespace].push pin.name
|
@@ -245,10 +245,6 @@ module Solargraph
|
|
245
245
|
pin.docstring.add_tag(tag)
|
246
246
|
end
|
247
247
|
end
|
248
|
-
# @todo This is probably not the best place for these overrides
|
249
|
-
superclass_references['Integer'] = ['Numeric']
|
250
|
-
superclass_references['Float'] = ['Numeric']
|
251
|
-
superclass_references['File'] = ['IO']
|
252
248
|
end
|
253
249
|
end
|
254
250
|
end
|