solargraph 0.23.3 → 0.23.4

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
2
  SHA256:
3
- metadata.gz: 37ebc106375480d4721557e69fb312eb21c7ab0d554448e7c71c975cdebc36af
4
- data.tar.gz: d9bd5e65e05323ade331a4d864029688bb46f1eac4456a3394e128988651c987
3
+ metadata.gz: 3d2dc2283964f7972f289ef9aa43a939948049b02d351f244ec522afc1033265
4
+ data.tar.gz: 8e60c7d6d9a3f7bd25fcbc66566c1ce795b3b8999572b454e6d07a027460ec4d
5
5
  SHA512:
6
- metadata.gz: 98be9bd79773d42e69e81cafefa214c9c6f9ea4b0fccb59386433d81dfd4718d69c97a1670c3f006f7fd445f6282a9575cb7a8f74a35b009f5f8b513496ed905
7
- data.tar.gz: 99fb8faa39d51725271b6bb92dde96e0b61933bd2350403784cee3aee65ca5179c879d05fe32e745608a14b9f96042d4a29e9245bd77f30b59449827a4db5205
6
+ metadata.gz: 9ffd40c951fb253bef3653525c9cbf10362582c292c529559b59698a1636939ed589fe76d9eacb01b26f6e7340c4f854d557fff0bd94a34e4b9d277196c3e637
7
+ data.tar.gz: d589e62eb1024c07eb2bd15cde0f29552a07089fa812b2508c51ad701622b1ab59e783b69f2cb4bc40645044c514f6167e83f2b1c3064c7eea8c372aad95c380
@@ -33,6 +33,12 @@ module Solargraph
33
33
  end
34
34
  @return_type
35
35
  end
36
+
37
+ def parameters
38
+ # Since attributes are generally equivalent to methods, treat
39
+ # them as methods without parameters
40
+ []
41
+ end
36
42
  end
37
43
  end
38
44
  end
@@ -93,7 +93,7 @@ module Solargraph
93
93
  # @param fqns [String] The namespace (nil for all)
94
94
  # @return [Array<Solargraph::Pin::Method>]
95
95
  def method_pins fqns = nil
96
- pins.select{|pin| pin.kind == Solargraph::Pin::METHOD}
96
+ pins.select{|pin| pin.kind == Solargraph::Pin::METHOD or pin.kind == Solargraph::Pin::ATTRIBUTE}
97
97
  end
98
98
 
99
99
  # @return [Array<Solargraph::Pin::Attribute>]
@@ -162,17 +162,6 @@ module Solargraph
162
162
  _locate_pin line, character, Pin::NAMESPACE, Pin::METHOD, Pin::BLOCK
163
163
  end
164
164
 
165
- def _locate_pin line, character, *kinds
166
- position = Solargraph::Source::Position.new(line, character)
167
- found = nil
168
- pins.each do |pin|
169
- found = pin if (kinds.empty? or kinds.include?(pin.kind)) and pin.location.range.contain?(position)
170
- break if pin.location.range.start.line > line
171
- end
172
- # @todo Assuming the root pin is always valid
173
- found || pins.first
174
- end
175
-
176
165
  # Get the nearest node that contains the specified index.
177
166
  #
178
167
  # @param line [Integer]
@@ -242,11 +231,9 @@ module Solargraph
242
231
  end
243
232
 
244
233
  def all_symbols
245
- result = []
246
- result.concat namespace_pins.reject{ |pin| pin.name.empty? }
247
- result.concat method_pins
248
- result.concat constant_pins
249
- result
234
+ @all_symbols ||= pins.select{ |pin|
235
+ [Pin::ATTRIBUTE, Pin::CONSTANT, Pin::METHOD, Pin::NAMESPACE].include?(pin.kind)
236
+ }
250
237
  end
251
238
 
252
239
  def locate_pin location
@@ -265,6 +252,17 @@ module Solargraph
265
252
 
266
253
  private
267
254
 
255
+ def _locate_pin line, character, *kinds
256
+ position = Solargraph::Source::Position.new(line, character)
257
+ found = nil
258
+ pins.each do |pin|
259
+ found = pin if (kinds.empty? or kinds.include?(pin.kind)) and pin.location.range.contain?(position)
260
+ break if pin.location.range.start.line > line
261
+ end
262
+ # @todo Assuming the root pin is always valid
263
+ found || pins.first
264
+ end
265
+
268
266
  def inner_node_references name, top
269
267
  result = []
270
268
  if top.kind_of?(AST::Node)
@@ -154,7 +154,7 @@ module Solargraph
154
154
  here = get_node_start_position(c)
155
155
  block = get_block_pin(here)
156
156
  pins.push Solargraph::Pin::Constant.new(get_node_location(c), fqn, c.children[1].to_s, docstring_for(c), resolve_node_signature(c.children[2]), infer_literal_node_type(c.children[2]), block, :public)
157
- elsif c.type == :def and c.children[0].to_s[0].match(/[a-z]/i)
157
+ elsif c.type == :def
158
158
  methpin = Solargraph::Pin::Method.new(get_node_location(c), fqn || '', c.children[(c.type == :def ? 0 : 1)].to_s, docstring_for(c), scope, visibility, get_method_args(c))
159
159
  if methpin.name == 'initialize' and methpin.scope == :instance
160
160
  pins.push Solargraph::Pin::Method.new(methpin.location, methpin.namespace, 'new', methpin.docstring, :class, :public, methpin.parameters)
@@ -1,3 +1,3 @@
1
1
  module Solargraph
2
- VERSION = '0.23.3'
2
+ VERSION = '0.23.4'
3
3
  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.23.3
4
+ version: 0.23.4
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-07-05 00:00:00.000000000 Z
11
+ date: 2018-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser