solargraph 0.5.2 → 0.5.3

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
  SHA1:
3
- metadata.gz: 9d63b5888bfb3dd7eb529ba3d608996891bb7e35
4
- data.tar.gz: 33b50877fdb1fd77554fadca922ae00c8683a7a3
3
+ metadata.gz: 34392923b4d66bd6306a6216e363aca3a504ff3b
4
+ data.tar.gz: 8025196be58e10a71a5d61bfe79d629598e3543f
5
5
  SHA512:
6
- metadata.gz: aea722501a008196ceae50a0d3169473e159a5438cebe19c3747665e1c5ae9489a9f1e55065334956f4b74d39aaac4ea84ffd67cb7dec6263c2fbbc26331eae7
7
- data.tar.gz: c20fefd1ee60adf1aa03b08504be25cee40d6cfa0aa988c1684a22cf10fbe7590f59dda14aba0cf33d78b77875fc2e66e6d28a52e9bf845dedbac1775afbc633
6
+ metadata.gz: 701214492f652110bff2a97f08a3fcc832600f3d8aac88f8d8d71cdb258b17c4fc32340ac7cc0c011856180d8698a8a67fa0ce705a81adb8b753e536a975e8e1
7
+ data.tar.gz: 8ece31aa4ee0e7918c32ef96df4d98cb4e2354035170eb65671003e0fcbdafb60509b6c71fc64ae58d22c1ea6385469430efb988e71f21000d70b2f375d0653a
@@ -334,6 +334,12 @@ module Solargraph
334
334
  top = true
335
335
  while parts.length > 0 and !type.nil?
336
336
  p = parts.shift
337
+ if top and scope == :class
338
+ first_class = find_fully_qualified_namespace(p, namespace)
339
+ sub = nil
340
+ sub = infer_signature_type(parts.join('.'), first_class, scope: :class) unless first_class.nil?
341
+ return sub unless sub.to_s == ''
342
+ end
337
343
  unless p == 'new' and scope != :instance
338
344
  if scope == :instance
339
345
  meths = get_instance_methods(type)
@@ -569,6 +575,7 @@ module Solargraph
569
575
  end
570
576
 
571
577
  def mappable?(node)
578
+ return true if node.kind_of?(AST::Node) and [:array, :hash, :str, :int, :float].include?(node.type)
572
579
  # TODO Add node.type :casgn (constant assignment)
573
580
  if node.kind_of?(AST::Node) and (node.type == :class or node.type == :module or node.type == :def or node.type == :defs or node.type == :ivasgn or node.type == :gvasgn or node.type == :lvasgn or node.type == :or_asgn)
574
581
  true
@@ -633,6 +640,8 @@ module Solargraph
633
640
  # TODO: The api_map should ignore local variables.
634
641
  type = node.children[0].type
635
642
  children.push node.children[0].children[0], node.children[1]
643
+ elsif [:array, :hash, :str, :int, :float].include?(node.type)
644
+ # @todo Do we really care about the details?
636
645
  end
637
646
  result = node.updated(type, children)
638
647
  result
@@ -147,10 +147,15 @@ module Solargraph
147
147
  end
148
148
 
149
149
  def suggest_at index, filtered: true, with_snippets: false
150
+ node = node_at(index - 2)
150
151
  return [] if string_at?(index)
151
152
  result = []
152
153
  phrase = phrase_at(index)
153
154
  signature = get_signature_at(index)
155
+ if (@code[index - 1] == '.')
156
+ type = infer(node_at(index - 2))
157
+ return @api_map.get_instance_methods(type) unless type.nil?
158
+ end
154
159
  if signature.start_with?('@')
155
160
  parts = signature.split('.')
156
161
  var = parts.shift
@@ -219,7 +224,11 @@ module Solargraph
219
224
  type = @api_map.infer_signature_type(signature, ns_here, scope: :class)
220
225
  result.concat @api_map.get_instance_methods(type) unless type.nil?
221
226
  else
222
- result.concat @api_map.get_methods(fqns)
227
+ if fqns == ns_here
228
+ result.concat @api_map.get_methods(fqns, '', visibility: [:private, :protected, :public])
229
+ else
230
+ result.concat @api_map.get_methods(fqns)
231
+ end
223
232
  end
224
233
  else
225
234
  # It's a local variable. Get the type from the node
@@ -1,3 +1,3 @@
1
1
  module Solargraph
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
3
3
  end
@@ -141,6 +141,10 @@ module Solargraph
141
141
  label += " #{args.join(', ')}" unless args.empty?
142
142
  meths.push Suggestion.new(label, insert: "#{n}", kind: Suggestion::METHOD, documentation: m.docstring, code_object: m, detail: "#{ns}", location: "#{m.file}:#{m.line}")
143
143
  }
144
+ # Collect superclass methods
145
+ if ns.kind_of?(YARD::CodeObjects::ClassObject) and !ns.superclass.nil?
146
+ meths += get_methods ns.superclass.to_s, '', visibility: [:public, :protected] unless ['Object', 'BasicObject', ''].include?(ns.superclass.to_s)
147
+ end
144
148
  if ns.kind_of?(YARD::CodeObjects::ClassObject) and namespace != 'Class'
145
149
  meths += get_instance_methods('Class')
146
150
  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.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-16 00:00:00.000000000 Z
11
+ date: 2017-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser