solargraph 0.21.0 → 0.21.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 04dd49e264774d545fbdf1a7f52d0b7227ff3f11
4
- data.tar.gz: cb617a8800b2eec8688c46fc89cf4ee79445dd50
2
+ SHA256:
3
+ metadata.gz: f93d18c2483c24a81693e662698b7d67e86086211608d6f50a0128b95cc817b6
4
+ data.tar.gz: f0346ff1adf21faebba30306cc2e682cf99d83bcedf66ebfca3029dad4031025
5
5
  SHA512:
6
- metadata.gz: db20a5e3053060171bf9077c1ce572de8428193b4d562c7d939c9a7003074de64f41ffe879100b7f7a31bb42f625a32e69ad7755afc68b8c31d2cc64d15be353
7
- data.tar.gz: bb9a311819e91501145c05fc2045178a791933fb6f9598e6265f68efe301664cbb6bfa50170928989d1fd8543a726cd36e0079b2f650c2ded36f9ad3a66c92c6
6
+ metadata.gz: d87a287c2608cbd7af255684a790ab079b85821a2abf3a6051212b36a156bf3662310bf5e9e7d3857ad89338b81628e94eb270dc74db258c6cb2ff2f4f0bc852
7
+ data.tar.gz: ad9ae29c4d354588e383fb68926175bad72e419a2ef736f7e9f7069c701d3b94bc5ab784768be4dd1823ef1ac65201bea9e971ea554c6918f2f23d9fd1c42b92
@@ -9,9 +9,11 @@ module Solargraph
9
9
  autoload :Completion, 'solargraph/api_map/completion'
10
10
  autoload :Probe, 'solargraph/api_map/probe'
11
11
  autoload :Store, 'solargraph/api_map/store'
12
+ autoload :TypeMethods, 'solargraph/api_map/type_methods'
12
13
 
13
14
  include Solargraph::ApiMap::SourceToYard
14
15
  include CoreFills
16
+ include TypeMethods
15
17
 
16
18
  # The workspace to analyze and process.
17
19
  #
@@ -310,7 +312,8 @@ module Solargraph
310
312
  end
311
313
  end
312
314
  end
313
- filtered = result.uniq(&:identifier).select{|s| s.kind != Pin::METHOD or s.name.match(/^[a-z0-9_]*(\!|\?|=)?$/i)}.sort_by.with_index{ |x, idx| [x.name, idx] }
315
+ frag_start = fragment.word.to_s.downcase
316
+ filtered = result.uniq(&:identifier).select{|s| s.name.downcase.start_with?(frag_start) and (s.kind != Pin::METHOD or s.name.match(/^[a-z0-9_]*(\!|\?|=)?$/i))}.sort_by.with_index{ |x, idx| [x.name, idx] }
314
317
  Completion.new(filtered, fragment.whole_word_range)
315
318
  end
316
319
 
@@ -475,7 +478,7 @@ module Solargraph
475
478
  result.concat yard_map.get_methods(fqns, '', visibility: visibility)
476
479
  type = get_namespace_type(fqns)
477
480
  result.concat inner_get_methods('Class', :instance, fqns == '' ? [:public] : visibility, deep, skip) if type == :class
478
- result.concat inner_get_methods('Module', :instance, fqns == '' ? [:public] : visibility, deep, skip)
481
+ result.concat inner_get_methods('Module', :instance, fqns == '' ? [:public] : visibility, deep, skip) if type == :module
479
482
  end
480
483
  end
481
484
  result
@@ -568,15 +571,5 @@ module Solargraph
568
571
  return yard_map.get_namespace_type(fqns) if pin.nil?
569
572
  pin.type
570
573
  end
571
-
572
- def extract_namespace_and_scope type
573
- scope = :instance
574
- result = type.to_s.gsub(/<.*$/, '')
575
- if (result == 'Class' or result == 'Module') and type.include?('<')
576
- result = type.match(/<([a-z0-9:_]*)/i)[1]
577
- scope = :class
578
- end
579
- [result, scope]
580
- end
581
574
  end
582
575
  end
@@ -6,8 +6,13 @@ module Solargraph
6
6
  def initialize return_type
7
7
  @return_type = return_type
8
8
  end
9
+ def namespace
10
+ @namespace ||= TypeMethods.extract_namespace(@return_type)
11
+ end
9
12
  end
10
13
 
14
+ include TypeMethods
15
+
11
16
  # @return [Solargraph::ApiMap]
12
17
  attr_reader :api_map
13
18
 
@@ -77,8 +82,11 @@ module Solargraph
77
82
  end
78
83
 
79
84
  # Method name search is external by default
85
+ # @param method_name [String]
86
+ # @param context_pin [Solargraph::Pin::Base]
80
87
  def infer_method_name_pins method_name, context_pin, internal = false
81
- namespace, scope = extract_namespace_and_scope(context_pin.return_type)
88
+ relname, scope = extract_namespace_and_scope(context_pin.return_type)
89
+ namespace = api_map.qualify(relname, context_pin.namespace)
82
90
  visibility = [:public]
83
91
  visibility.push :protected, :private if internal
84
92
  result = api_map.get_methods(namespace, scope: scope, visibility: visibility).select{|pin| pin.name == method_name}
@@ -110,35 +118,6 @@ module Solargraph
110
118
  type.sub(/<#{rns}>/, "<#{res}>")
111
119
  end
112
120
 
113
- # Extract a namespace from a type.
114
- #
115
- # @example
116
- # extract_namespace('String') => 'String'
117
- # extract_namespace('Class<String>') => 'String'
118
- #
119
- # @return [String]
120
- def extract_namespace type
121
- extract_namespace_and_scope(type)[0]
122
- end
123
-
124
- # Extract a namespace and a scope (:instance or :class) from a type.
125
- #
126
- # @example
127
- # extract_namespace('String') #=> ['String', :instance]
128
- # extract_namespace('Class<String>') #=> ['String', :class]
129
- # extract_namespace('Module<Enumerable') #=> ['Enumberable', :class]
130
- #
131
- # @return [Array] The namespace (String) and scope (Symbol).
132
- def extract_namespace_and_scope type
133
- scope = :instance
134
- result = type.to_s.gsub(/<.*$/, '')
135
- if (result == 'Class' or result == 'Module') and type.include?('<')
136
- result = type.match(/<([a-z0-9:_]*)/i)[1]
137
- scope = :class
138
- end
139
- [result, scope]
140
- end
141
-
142
121
  # Extract a namespace and a scope from a pin. For now, the pin must
143
122
  # be either a namespace, a method, or a block.
144
123
  #
@@ -0,0 +1,40 @@
1
+ module Solargraph
2
+ class ApiMap
3
+ # Module functions for processing YARD types.
4
+ #
5
+ module TypeMethods
6
+ module_function
7
+
8
+ # Extract a namespace from a type.
9
+ #
10
+ # @example
11
+ # extract_namespace('String') => 'String'
12
+ # extract_namespace('Class<String>') => 'String'
13
+ #
14
+ # @param type [String]
15
+ # @return [String]
16
+ def extract_namespace type
17
+ extract_namespace_and_scope(type)[0]
18
+ end
19
+
20
+ # Extract a namespace and a scope (:instance or :class) from a type.
21
+ #
22
+ # @example
23
+ # extract_namespace('String') #=> ['String', :instance]
24
+ # extract_namespace('Class<String>') #=> ['String', :class]
25
+ # extract_namespace('Module<Enumerable') #=> ['Enumberable', :class]
26
+ #
27
+ # @param type [String]
28
+ # @return [Array] The namespace (String) and scope (Symbol).
29
+ def extract_namespace_and_scope type
30
+ scope = :instance
31
+ result = type.to_s.gsub(/<.*$/, '')
32
+ if (result == 'Class' or result == 'Module') and type.include?('<')
33
+ result = type.match(/<([a-z0-9:_]*)/i)[1]
34
+ scope = :class
35
+ end
36
+ [result, scope]
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,10 +1,15 @@
1
1
  module Solargraph
2
+ # The Diagnostics library provides reporters for analyzing problems in code
3
+ # and providing the results to language server clients.
4
+ #
2
5
  module Diagnostics
3
6
  autoload :Base, 'solargraph/diagnostics/base'
4
7
  autoload :Severities, 'solargraph/diagnostics/severities'
5
8
  autoload :Rubocop, 'solargraph/diagnostics/rubocop'
6
9
  autoload :RequireNotFound, 'solargraph/diagnostics/require_not_found'
7
10
 
11
+ # Reporters identified by name for activation in .solargraph.yml files.
12
+ #
8
13
  REPORTERS = {
9
14
  'rubocop' => Rubocop,
10
15
  'require_not_found' => RequireNotFound
@@ -1,5 +1,10 @@
1
1
  module Solargraph
2
2
  module Diagnostics
3
+ # RequireNotFound reports required paths that could not be resolved to
4
+ # either a file in the workspace or a gem.
5
+ #
6
+ # @todo Some stdlib paths can result in false positives.
7
+ #
3
8
  class RequireNotFound < Base
4
9
  def diagnose source, api_map
5
10
  result = []
@@ -3,6 +3,8 @@ require 'shellwords'
3
3
 
4
4
  module Solargraph
5
5
  module Diagnostics
6
+ # This reporter provides linting through RuboCop.
7
+ #
6
8
  class Rubocop < Base
7
9
  # The rubocop command
8
10
  #
@@ -21,6 +23,7 @@ module Solargraph
21
23
  raise DiagnosticsError, 'No command specified' if command.nil? or command.empty?
22
24
  cmd = "#{Shellwords.escape(command)} -f j -s #{Shellwords.escape(filename)}"
23
25
  o, e, s = Open3.capture3(cmd, stdin_data: text)
26
+ STDERR.puts e unless e.empty?
24
27
  raise DiagnosticsError, "Command '#{command}' is not available (gem exception)" if e.include?('Gem::Exception')
25
28
  raise DiagnosticsError, "RuboCop returned empty data" if o.empty?
26
29
  make_array JSON.parse(o)
@@ -37,14 +37,7 @@ module Solargraph
37
37
  }
38
38
  end
39
39
 
40
- def response
41
- response = {}
42
- response[:result] = result
43
- response[:error] = error unless error.nil?
44
- response
45
- end
46
-
47
- def send
40
+ def send_response
48
41
  unless id.nil? or host.cancel?(id)
49
42
  response = {
50
43
  jsonrpc: "2.0",
@@ -30,6 +30,10 @@ module Solargraph
30
30
  elsif params['verbose']
31
31
  host.show_message "The Solargraph gem is up to date (version #{Solargraph::VERSION})."
32
32
  end
33
+ set_result({
34
+ installed: current,
35
+ available: available
36
+ })
33
37
  end
34
38
  end
35
39
  end
@@ -9,6 +9,10 @@ module Solargraph
9
9
  def process result
10
10
  @block.call(result) unless @block.nil?
11
11
  end
12
+
13
+ def send_response
14
+ # noop
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -18,13 +18,13 @@ module Solargraph
18
18
  start_timers
19
19
  end
20
20
 
21
- def process message
21
+ def process request
22
22
  Thread.new do
23
- message = @host.start(message)
24
- message.send
23
+ message = @host.start(request)
24
+ message.send_response
25
25
  tmp = @host.flush
26
26
  send_data tmp unless tmp.empty?
27
- GC.start unless message['method'] == 'textDocument/didChange'
27
+ GC.start unless request['method'] == 'textDocument/didChange'
28
28
  end
29
29
  end
30
30
 
@@ -53,6 +53,10 @@ module Solargraph
53
53
  end
54
54
  end
55
55
 
56
+ def stop
57
+ @io.close
58
+ end
59
+
56
60
  protected
57
61
 
58
62
  def load_environment
@@ -66,8 +70,8 @@ module Solargraph
66
70
 
67
71
  def start_process
68
72
  dir = Dir.pwd
69
- unless api_map.nil? or api_map.workspace.nil?
70
- dir = api_map.workspace
73
+ unless api_map.nil? or api_map.workspace.nil? or api_map.workspace.directory.nil?
74
+ dir = api_map.workspace.directory
71
75
  end
72
76
  Dir.chdir(dir) do
73
77
  @io = IO.popen(executable, 'r+')
@@ -1,5 +1,8 @@
1
1
  module Solargraph
2
2
  class Source
3
+ # A custom builder for source parsers that ignores character encoding
4
+ # issues in literal strings.
5
+ #
3
6
  class FlawedBuilder < Parser::Builders::Default
4
7
  def string_value(token)
5
8
  value(token)
@@ -1,11 +1,19 @@
1
1
  module Solargraph
2
2
  class Source
3
+ # The Mapper generates pins and other data for Sources.
4
+ #
5
+ # This class is used internally by the Source class on initialization,
6
+ # e.g., via Source.new or Source.load. Users should not normally need to
7
+ # call it directly.
8
+ #
3
9
  class Mapper
4
10
  include NodeMethods
5
11
 
6
12
  private_class_method :new
7
13
 
8
- # @return [Array<Solargraph::Pin::Base>]
14
+ # Generate the data.
15
+ #
16
+ # @return [Array]
9
17
  def map filename, code, node, comments
10
18
  @filename = filename
11
19
  @code = code
@@ -37,7 +45,7 @@ module Solargraph
37
45
  end
38
46
 
39
47
  class << self
40
- # @return [Array<Solargraph::Pin::Base>]
48
+ # @return [Array]
41
49
  def map filename, code, node, comments
42
50
  new.map filename, code, node, comments
43
51
  end
@@ -134,7 +142,6 @@ module Solargraph
134
142
  pins.push Solargraph::Pin::GlobalVariable.new(get_node_location(c), fqn, c.children[0].to_s, docstring_for(c), resolve_node_signature(c.children[1]), infer_literal_node_type(c.children[1]), @pins.first)
135
143
  elsif c.type == :sym
136
144
  @symbols.push Solargraph::Pin::Symbol.new(get_node_location(c), ":#{c.children[0]}")
137
-
138
145
  elsif c.type == :casgn
139
146
  here = get_node_start_position(c)
140
147
  block = get_block_pin(here)
@@ -146,12 +153,15 @@ module Solargraph
146
153
  # @todo Smelly instance variable access.
147
154
  pins.last.instance_variable_set(:@return_type, methpin.namespace)
148
155
  pins.push Solargraph::Pin::Method.new(methpin.location, methpin.namespace, methpin.name, methpin.docstring, methpin.scope, :private, methpin.parameters)
156
+ elsif visibility == :module_function
157
+ pins.push Solargraph::Pin::Method.new(methpin.location, methpin.namespace, methpin.name, methpin.docstring, :class, :public, methpin.parameters)
158
+ pins.push Solargraph::Pin::Method.new(methpin.location, methpin.namespace, methpin.name, methpin.docstring, :instance, :private, methpin.parameters)
149
159
  else
150
160
  pins.push methpin
151
161
  end
152
162
  elsif c.type == :defs
153
163
  s_visi = visibility
154
- s_visi = :public if scope != :class
164
+ s_visi = :public if s_visi == :module_function or scope != :class
155
165
  if c.children[0].is_a?(AST::Node) and c.children[0].type == :self
156
166
  dfqn = fqn || ''
157
167
  else
@@ -191,6 +201,26 @@ module Solargraph
191
201
  end
192
202
  end
193
203
  next
204
+ elsif c.type == :send and c.children[1] == :module_function
205
+ # @todo Handle module_function
206
+ if c.children[2].nil?
207
+ visibility = :module_function
208
+ elsif c.children[2].type == :sym or c.children[2].type == :str
209
+ # @todo What to do about references?
210
+ c.children[2..-1].each do |x|
211
+ cn = x.children[0].to_s
212
+ ref = pins.select{|p| p.namespace == (fqn || '') and p.name == cn}.first
213
+ unless ref.nil?
214
+ pins.delete ref
215
+ pins.push Solargraph::Pin::Method.new(ref.location, ref.namespace, ref.name, ref.docstring, :class, :public, ref.parameters)
216
+ pins.push Solargraph::Pin::Method.new(ref.location, ref.namespace, ref.name, ref.docstring, :instance, :private, ref.parameters)
217
+ end
218
+ end
219
+ elsif c.children[2].type == :def
220
+ # @todo A single function
221
+ process c, tree, :module_function, :class, fqn, stack
222
+ next
223
+ end
194
224
  elsif c.type == :send and c.children[1] == :include and c.children[0].nil?
195
225
  last_node = get_last_in_stack_not_begin(stack)
196
226
  if last_node.nil? or last_node.type == :class or last_node.type == :module or last_node.type == :source
@@ -207,14 +237,16 @@ module Solargraph
207
237
  elsif c.type == :send and c.children[1] == :extend and c.children[0].nil?
208
238
  last_node = get_last_in_stack_not_begin(stack)
209
239
  if last_node.nil? or last_node.type == :class or last_node.type == :module or last_node.type == :source
210
- if c.children[2].kind_of?(AST::Node) and c.children[2].type == :const
211
- # namespace_extends[fqn || ''] ||= []
212
- c.children[2..-1].each do |i|
213
- nspin = @pins.select{|pin| pin.kind == Pin::NAMESPACE and pin.path == fqn}.last
214
- unless nspin.nil?
240
+ c.children[2..-1].each do |i|
241
+ nspin = @pins.select{|pin| pin.kind == Pin::NAMESPACE and pin.path == fqn}.last
242
+ unless nspin.nil?
243
+ ref = nil
244
+ if i.type == :self
245
+ ref = Pin::Reference.new(get_node_location(c), nspin.path, nspin.path)
246
+ elsif i.type == :const
215
247
  ref = Pin::Reference.new(get_node_location(c), nspin.path, unpack_name(i))
216
- nspin.extend_references.push(ref)
217
248
  end
249
+ nspin.extend_references.push(ref) unless ref.nil?
218
250
  end
219
251
  end
220
252
  end
@@ -16,6 +16,7 @@ module Solargraph
16
16
  # Get a hash of the position. This representation is suitable for use in
17
17
  # the language server protocol.
18
18
  #
19
+ # @return [Hash]
19
20
  def to_hash
20
21
  {
21
22
  line: line,
@@ -23,6 +24,11 @@ module Solargraph
23
24
  }
24
25
  end
25
26
 
27
+ # Get a numeric offset for the specified text and position.
28
+ #
29
+ # @param text [String]
30
+ # @param position [Position]
31
+ # @return [Integer]
26
32
  def self.to_offset text, position
27
33
  result = 0
28
34
  feed = 0
@@ -41,10 +47,22 @@ module Solargraph
41
47
  result
42
48
  end
43
49
 
50
+ # Get a numeric offset for the specified text and a position identified
51
+ # by its line and character.
52
+ #
53
+ # @param text [String]
54
+ # @param line [Integer]
55
+ # @param character [Integer]
56
+ # @return [Integer]
44
57
  def self.line_char_to_offset text, line, character
45
58
  to_offset(text, Position.new(line, character))
46
59
  end
47
60
 
61
+ # Get a position for the specified text and offset.
62
+ #
63
+ # @param text [String]
64
+ # @param offset [Integer]
65
+ # @return [Position]
48
66
  def self.from_offset text, offset
49
67
  cursor = 0
50
68
  line = 0
@@ -17,6 +17,7 @@ module Solargraph
17
17
  # Get a hash of the range. This representation is suitable for use in
18
18
  # the language server protocol.
19
19
  #
20
+ # @return [Hash<Symbol, Position>]
20
21
  def to_hash
21
22
  {
22
23
  start: start.to_hash,
@@ -24,6 +25,9 @@ module Solargraph
24
25
  }
25
26
  end
26
27
 
28
+ # True if the specified position is inside the range.
29
+ #
30
+ # @return [Boolean]
27
31
  def contain? position
28
32
  return false if position.line < start.line
29
33
  return false if position.line == start.line and position.character < start.character
@@ -38,7 +42,7 @@ module Solargraph
38
42
  # @param c1 [Integer] Starting character
39
43
  # @param l2 [Integer] Ending line
40
44
  # @param c2 [Integer] Ending character
41
- # @return [Position]
45
+ # @return [Range]
42
46
  def self.from_to l1, c1, l2, c2
43
47
  Range.new(Position.new(l1, c1), Position.new(l2, c2))
44
48
  end
@@ -1,3 +1,3 @@
1
1
  module Solargraph
2
- VERSION = '0.21.0'
2
+ VERSION = '0.21.1'
3
3
  end
@@ -1,16 +1,23 @@
1
1
  require 'yard'
2
2
 
3
3
  module Solargraph
4
+ # The YardMap provides access to YARD documentation for the Ruby core, the
5
+ # stdlib, and gems.
6
+ #
4
7
  class YardMap
5
8
  autoload :Cache, 'solargraph/yard_map/cache'
6
9
  autoload :CoreDocs, 'solargraph/yard_map/core_docs'
7
10
 
8
11
  CoreDocs.require_minimum
9
12
  @@stdlib_yardoc = CoreDocs.yard_stdlib_file
10
- @@stdlib_namespaces = []
13
+ @@stdlib_paths = {}
11
14
  YARD::Registry.load! @@stdlib_yardoc
12
15
  YARD::Registry.all(:class, :module).each do |ns|
13
- @@stdlib_namespaces.push ns.path
16
+ next if ns.file.nil?
17
+ path = ns.file.sub(/^(ext|lib)\//, '').sub(/\.(rb|c)$/, '')
18
+ next if path.start_with?('-')
19
+ @@stdlib_paths[path] ||= []
20
+ @@stdlib_paths[path].push ns
14
21
  end
15
22
 
16
23
  # @return [Solargraph::Workspace]
@@ -25,6 +32,7 @@ module Solargraph
25
32
  @required = required.clone
26
33
  @namespace_yardocs = {}
27
34
  @gem_paths = {}
35
+ @stdlib_namespaces = []
28
36
  process_requires
29
37
  yardocs.push CoreDocs.yardoc_file
30
38
  yardocs.uniq!
@@ -99,12 +107,16 @@ module Solargraph
99
107
  result = []
100
108
  combined_namespaces(namespace, scope).each do |ns|
101
109
  yardocs_documenting(ns).each do |y|
110
+ # @todo Getting constants from the stdlib works slightly differently
111
+ # from methods
112
+ next if y == @@stdlib_yardoc
102
113
  yard = load_yardoc(y)
103
114
  unless yard.nil?
104
115
  found = yard.at(ns)
105
116
  consts.concat found.children unless found.nil?
106
117
  end
107
118
  end
119
+ consts.concat @stdlib_namespaces.select{|ns| ns.namespace.path == namespace}
108
120
  end
109
121
  consts.each { |c|
110
122
  detail = nil
@@ -170,6 +182,8 @@ module Solargraph
170
182
  unless ns.nil?
171
183
  ns.meths(scope: :instance, visibility: visibility).each do |m|
172
184
  n = m.to_s.split(/[\.#]/).last
185
+ # HACK: Exception for Module#module_function in Class
186
+ next if ns.name == :Class and m.path == 'Module#module_function'
173
187
  # HACK: Special treatment for #initialize
174
188
  next if n == 'initialize' and !visibility.include?(:private)
175
189
  if (namespace == 'Kernel' or !m.to_s.start_with?('Kernel#')) and !m.docstring.to_s.include?(':nodoc:')
@@ -203,10 +217,12 @@ module Solargraph
203
217
  while parts.length > 0
204
218
  here = "#{parts.join('::')}::#{namespace}"
205
219
  return here unless yardocs_documenting(here).empty?
220
+ return here if @stdlib_namespaces.any?{|ns| ns.path == here}
206
221
  parts.pop
207
222
  end
208
223
  end
209
224
  return namespace unless yardocs_documenting(namespace).empty?
225
+ return namespace if @stdlib_namespaces.any?{|ns| ns.path == namespace}
210
226
  nil
211
227
  end
212
228
 
@@ -221,6 +237,9 @@ module Solargraph
221
237
  end
222
238
  end
223
239
  }
240
+ @stdlib_namespaces.each do |ns|
241
+ result.push Pin::YardObject.new(ns, object_location(ns)) if ns.path == path
242
+ end
224
243
  result
225
244
  end
226
245
 
@@ -266,6 +285,7 @@ module Solargraph
266
285
  tried = []
267
286
  unresolved_requires.clear
268
287
  required.each do |r|
288
+ next if r.nil?
269
289
  begin
270
290
  spec = Gem::Specification.find_by_path(r) || Gem::Specification.find_by_name(r.split('/').first)
271
291
  ver = spec.version.to_s
@@ -278,7 +298,12 @@ module Solargraph
278
298
  yardocs.unshift yd unless yd.nil? or yardocs.include?(yd)
279
299
  rescue Gem::LoadError => e
280
300
  next if !workspace.nil? and workspace.would_require?(r)
281
- unresolved_requires.push r
301
+ stdnames = []
302
+ @@stdlib_paths.each_pair do |path, objects|
303
+ stdnames.concat objects if path == r or path.start_with?("#{r}/")
304
+ end
305
+ @stdlib_namespaces.concat stdnames
306
+ unresolved_requires.push r if stdnames.empty?
282
307
  end
283
308
  end
284
309
  end
@@ -315,7 +340,9 @@ module Solargraph
315
340
  else
316
341
  result.concat @namespace_yardocs[namespace] unless @namespace_yardocs[namespace].nil?
317
342
  end
318
- result.push @@stdlib_yardoc if result.empty? and @@stdlib_namespaces.include?(namespace)
343
+ if @stdlib_namespaces.map(&:path).include?(namespace)
344
+ result.push @@stdlib_yardoc
345
+ end
319
346
  result
320
347
  end
321
348
 
@@ -77,7 +77,7 @@ module Solargraph
77
77
 
78
78
  def download version
79
79
  FileUtils.mkdir_p cache_dir
80
- uri = URI.parse("http://solargraph.org/download/#{version}.tar.gz")
80
+ uri = URI.parse("#{SOURCE}/#{version}.tar.gz")
81
81
  response = Net::HTTP.get_response(uri)
82
82
  zipfile = File.join(cache_dir, "#{version}.tar.gz")
83
83
  File.binwrite zipfile, response.body
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.21.0
4
+ version: 0.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-07 00:00:00.000000000 Z
11
+ date: 2018-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -226,6 +226,7 @@ files:
226
226
  - lib/solargraph/api_map/probe.rb
227
227
  - lib/solargraph/api_map/source_to_yard.rb
228
228
  - lib/solargraph/api_map/store.rb
229
+ - lib/solargraph/api_map/type_methods.rb
229
230
  - lib/solargraph/core_fills.rb
230
231
  - lib/solargraph/diagnostics.rb
231
232
  - lib/solargraph/diagnostics/base.rb
@@ -356,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
356
357
  version: '0'
357
358
  requirements: []
358
359
  rubyforge_project:
359
- rubygems_version: 2.4.5
360
+ rubygems_version: 2.7.6
360
361
  signing_key:
361
362
  specification_version: 4
362
363
  summary: Solargraph for Ruby