solargraph 0.13.1 → 0.13.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a515f53b1eebf187bf4108abdba6c591f438cdb6
4
- data.tar.gz: 832c13c89dcdf1bae7cb69aa3433d73346b86bec
3
+ metadata.gz: ed95e7c0676d9b744be9c8c006104ae42fdce15f
4
+ data.tar.gz: b67a658208dd50359c7b0aa0118c646b89696f93
5
5
  SHA512:
6
- metadata.gz: 74f08e71b1c0834aa6b18f4dcb0e176f91d0a40ac6f8a3fe3c76ad95081096eec4cb2ed904aaa7586433d05f8520214b9d1185755a549a2045870ba661acfd6e
7
- data.tar.gz: 7ddcdf66369a65533d14e3c13763dad0ecb3f306b4b0ce7ef707802a61ae5b6c6d13a979b48bdd64c76b823064d32d9d1dd57dbd917d60e50dca018db1ab6799
6
+ metadata.gz: b28a0447fd5d9f555ab0a94fbabb0e08df008107f882e1f6d993de857012d3b8c243d0c34fdbb133f9c3e20393534c683dfd10be485beb32d068f18c7a654c77
7
+ data.tar.gz: ee15faa36e173dfd9ca12f0b2eddc5225cf420136db7831adafea1303e585e49786b6e3b74ddc0618a22f6837381e93049a5319b1a14b1ec6e9e1f4dd089b3a7
@@ -106,7 +106,7 @@ module Solargraph
106
106
 
107
107
  def namespaces
108
108
  refresh
109
- @namespace_map.keys
109
+ namespace_map.keys
110
110
  end
111
111
 
112
112
  def namespace_exists? name, root = ''
@@ -153,7 +153,7 @@ module Solargraph
153
153
  end
154
154
  else
155
155
  if (root == '')
156
- return name unless @namespace_map[name].nil?
156
+ return name unless namespace_map[name].nil?
157
157
  get_include_strings_from(*file_nodes).each { |i|
158
158
  reroot = "#{root == '' ? '' : root + '::'}#{i}"
159
159
  recname = find_fully_qualified_namespace name.to_s, reroot, skip
@@ -163,10 +163,10 @@ module Solargraph
163
163
  roots = root.to_s.split('::')
164
164
  while roots.length > 0
165
165
  fqns = roots.join('::') + '::' + name
166
- return fqns unless @namespace_map[fqns].nil?
166
+ return fqns unless namespace_map[fqns].nil?
167
167
  roots.pop
168
168
  end
169
- return name unless @namespace_map[name].nil?
169
+ return name unless namespace_map[name].nil?
170
170
  get_include_strings_from(*file_nodes).each { |i|
171
171
  recname = find_fully_qualified_namespace name, i, skip
172
172
  return recname unless recname.nil?
@@ -179,7 +179,7 @@ module Solargraph
179
179
  def get_namespace_nodes(fqns)
180
180
  return file_nodes if fqns == '' or fqns.nil?
181
181
  refresh
182
- @namespace_map[fqns] || []
182
+ namespace_map[fqns] || []
183
183
  end
184
184
 
185
185
  # @return [Array<Solargraph::Pin::InstanceVariable>]
@@ -432,6 +432,7 @@ module Solargraph
432
432
  end
433
433
 
434
434
  def get_path_suggestions path
435
+ refresh
435
436
  result = []
436
437
  if path.include?('#')
437
438
  # It's an instance method
@@ -454,11 +455,21 @@ module Solargraph
454
455
 
455
456
  private
456
457
 
458
+ # @return [Hash]
459
+ def namespace_map
460
+ @namespace_map ||= {}
461
+ end
462
+
463
+ # @return [Hash]
464
+ def namespace_tree
465
+ @namespace_tree ||= {}
466
+ end
467
+
457
468
  def clear
458
469
  @stale = false
459
470
  @parent_stack = {}
460
- @namespace_map = {}
461
- @namespace_tree = {}
471
+ namespace_map.clear
472
+ namespace_tree.clear
462
473
  @required = []
463
474
  end
464
475
 
@@ -482,8 +493,8 @@ module Solargraph
482
493
  @namespace_includes = {}
483
494
  @superclasses = {}
484
495
  @parent_stack = {}
485
- @namespace_map = {}
486
- @namespace_tree = {}
496
+ namespace_map.clear
497
+ namespace_tree.clear
487
498
  @required = []
488
499
  @pin_suggestions = {}
489
500
  unless @virtual_source.nil?
@@ -491,8 +502,8 @@ module Solargraph
491
502
  end
492
503
  @sources.values.each do |s|
493
504
  s.namespace_nodes.each_pair do |k, v|
494
- @namespace_map[k] ||= []
495
- @namespace_map[k].concat v
505
+ namespace_map[k] ||= []
506
+ namespace_map[k].concat v
496
507
  add_to_namespace_tree k.split('::')
497
508
  end
498
509
  end
@@ -506,11 +517,13 @@ module Solargraph
506
517
  def process_virtual
507
518
  unless @virtual_source.nil?
508
519
  cache.clear
520
+ namespace_map.clear
521
+ namespace_tree.clear
509
522
  @sources[@virtual_filename] = @virtual_source
510
523
  @sources.values.each do |s|
511
524
  s.namespace_nodes.each_pair do |k, v|
512
- @namespace_map[k] ||= []
513
- @namespace_map[k].concat v
525
+ namespace_map[k] ||= []
526
+ namespace_map[k].concat v
514
527
  add_to_namespace_tree k.split('::')
515
528
  end
516
529
  end
@@ -632,7 +645,7 @@ module Solargraph
632
645
  skip.push fqns
633
646
  nodes = get_namespace_nodes(fqns)
634
647
  unless nodes.empty?
635
- cursor = @namespace_tree
648
+ cursor = namespace_tree
636
649
  parts = fqns.split('::')
637
650
  parts.each { |p|
638
651
  cursor = cursor[p]
@@ -721,7 +734,7 @@ module Solargraph
721
734
  end
722
735
 
723
736
  def add_to_namespace_tree tree
724
- cursor = @namespace_tree
737
+ cursor = namespace_tree
725
738
  tree.each { |t|
726
739
  cursor[t.to_s] ||= {}
727
740
  cursor = cursor[t.to_s]
@@ -242,7 +242,7 @@ module Solargraph
242
242
  end
243
243
  end
244
244
  else
245
- result.concat api_map.get_instance_methods(type)
245
+ result.concat api_map.get_instance_methods(type) unless (type == '' and signature.include?('.'))
246
246
  end
247
247
  result = reduce_starting_with(result, word_at(index)) if filtered
248
248
  result.uniq{|s| s.path}.sort{|a,b| a.label <=> b.label}
@@ -1,3 +1,3 @@
1
1
  module Solargraph
2
- VERSION = '0.13.1'
2
+ VERSION = '0.13.2'
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.13.1
4
+ version: 0.13.2
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-10-30 00:00:00.000000000 Z
11
+ date: 2017-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser