solargraph 0.5.0 → 0.5.1

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: 7d08698f9e91d4e08d2826494bb69eeb81fd8675
4
- data.tar.gz: 4fb6952fdc4c54106ffdefa2d596ad764cc6d0c9
3
+ metadata.gz: fc2beed7eafc3145abaeabd5c12b1e21faa1a511
4
+ data.tar.gz: 9d7f689adda7c1b6b47cbae5fc73e21c47b494ff
5
5
  SHA512:
6
- metadata.gz: 336d028676662a1315d4c9686c8c09a052618cf2ac0156a9fcf89e376ffcbec53b32c819ac5c9c77291c20eb88c63ed0fa3f1e19e185e5a1924e34e68651d045
7
- data.tar.gz: 73d41b0eee445ad355d675ab4cff779330053130dd6fe1e85f5da21a1cd4a8373d707e60401675c8855002809bad34b1bfb8b04ff134717296120cfe9a166934
6
+ metadata.gz: f108af9d8b4deb6e61700cb4d239aefafd2d596efd914632d71f270f2ff2e1b08cc6ea5e661a9571517a69dfb627a7cd898b489dd4a9977dba9349df701f050b
7
+ data.tar.gz: 2a35d50d979bb0b24221d7f4d8983c7b14f620003b5b3167631990404458446c25277fc441491579c6ab6ecdebe536935934cca5be3b40c9d34da53c9c307e64
@@ -32,7 +32,7 @@ module Solargraph
32
32
  append_file(extra)
33
33
  end
34
34
  files = []
35
- opts = options
35
+ opts = yard_options
36
36
  (opts[:include] - opts[:exclude]).each { |glob|
37
37
  files += Dir[File.join @workspace, glob]
38
38
  }
@@ -54,27 +54,6 @@ module Solargraph
54
54
  @required = []
55
55
  end
56
56
 
57
- def options
58
- o = {
59
- include: [],
60
- exclude: []
61
- }
62
- unless workspace.nil?
63
- yardopts_file = File.join(workspace, '.yardopts')
64
- if File.exist?(yardopts_file)
65
- yardopts = File.read(yardopts_file)
66
- yardopts.lines.each { |line|
67
- arg = line.strip
68
- if !arg.start_with?('-')
69
- o[:include].push arg
70
- end
71
- }
72
- end
73
- end
74
- o[:include].concat ['app/**/*.rb', 'lib/**/*.rb'] if o[:include].empty?
75
- o
76
- end
77
-
78
57
  def yard_map
79
58
  @yard_map ||= YardMap.new(required: required, workspace: workspace)
80
59
  end
@@ -167,7 +146,7 @@ module Solargraph
167
146
  unless fqns.nil? or skip.include?(fqns)
168
147
  skip.push fqns
169
148
  nodes = get_namespace_nodes(fqns)
170
- #nodes.delete_if { |n| yardoc_has_file?(get_filename_for(n))}
149
+ nodes.delete_if { |n| yardoc_has_file?(get_filename_for(n))}
171
150
  unless nodes.empty?
172
151
  cursor = @namespace_tree
173
152
  parts = fqns.split('::')
@@ -268,6 +247,17 @@ module Solargraph
268
247
  root.nil? ? nil : root.children[0]
269
248
  end
270
249
 
250
+ def yardoc_has_file?(file)
251
+ return false if workspace.nil?
252
+ if @yardoc_files.nil?
253
+ @yardoc_files = []
254
+ yard_options[:include].each { |glob|
255
+ @yardoc_files.concat Dir[File.join workspace, glob]
256
+ }
257
+ end
258
+ @yardoc_files.include?(file)
259
+ end
260
+
271
261
  def inner_get_instance_variables(node, scope)
272
262
  arr = []
273
263
  if node.kind_of?(AST::Node)
@@ -487,7 +477,7 @@ module Solargraph
487
477
  return meths if fqns.nil?
488
478
  nodes = get_namespace_nodes(fqns)
489
479
  nodes.each { |n|
490
- #unless yardoc_has_file?(get_filename_for(n))
480
+ unless yardoc_has_file?(get_filename_for(n))
491
481
  if n.kind_of?(AST::Node)
492
482
  if n.type == :class and !n.children[1].nil?
493
483
  s = unpack_name(n.children[1])
@@ -495,7 +485,7 @@ module Solargraph
495
485
  end
496
486
  meths += inner_get_methods_from_node(n, root, skip)
497
487
  end
498
- #end
488
+ end
499
489
  }
500
490
  meths.uniq
501
491
  end
@@ -533,7 +523,7 @@ module Solargraph
533
523
  skip.push fqns
534
524
  nodes = get_namespace_nodes(fqns)
535
525
  nodes.each { |n|
536
- #unless yardoc_has_file?(get_filename_for(n))
526
+ unless yardoc_has_file?(get_filename_for(n))
537
527
  if n.kind_of?(AST::Node)
538
528
  if n.type == :class and !n.children[1].nil?
539
529
  s = unpack_name(n.children[1])
@@ -569,7 +559,7 @@ module Solargraph
569
559
  end
570
560
  }
571
561
  end
572
- #end
562
+ end
573
563
  # This is necessary to get included modules from workspace definitions
574
564
  get_include_strings_from(n).each { |i|
575
565
  meths += inner_get_instance_methods(i, fqns, skip)
@@ -197,7 +197,7 @@ module Solargraph
197
197
  result += @api_map.get_instance_methods('Kernel')
198
198
  end
199
199
  result = reduce_starting_with(result, word_at(index)) if filtered
200
- result
200
+ result.uniq{|s| s.path}
201
201
  end
202
202
 
203
203
  # Find the signature at the specified index and get suggestions based
@@ -62,5 +62,28 @@ module Solargraph
62
62
  end
63
63
  parts
64
64
  end
65
+
66
+ def yard_options
67
+ if @yard_options.nil?
68
+ @yard_options = {
69
+ include: [],
70
+ exclude: []
71
+ }
72
+ unless workspace.nil?
73
+ yardopts_file = File.join(workspace, '.yardopts')
74
+ if File.exist?(yardopts_file)
75
+ yardopts = File.read(yardopts_file)
76
+ yardopts.lines.each { |line|
77
+ arg = line.strip
78
+ if !arg.start_with?('-')
79
+ @yard_options[:include].push arg
80
+ end
81
+ }
82
+ end
83
+ end
84
+ @yard_options[:include].concat ['app/**/*.rb', 'lib/**/*.rb'] if @yard_options[:include].empty?
85
+ end
86
+ @yard_options
87
+ end
65
88
  end
66
89
  end
@@ -11,7 +11,8 @@ module Solargraph
11
11
  @@semaphore = Mutex.new
12
12
 
13
13
  post '/prepare' do
14
- prepare_workspace params['directory']
14
+ STDERR.puts "Preparing #{params['workspace']}"
15
+ Server.prepare_workspace params['workspace']
15
16
  end
16
17
 
17
18
  post '/suggest' do
@@ -65,7 +66,7 @@ module Solargraph
65
66
 
66
67
  class << self
67
68
  def run!
68
- constant_updates
69
+ #constant_updates
69
70
  super
70
71
  end
71
72
 
@@ -22,6 +22,10 @@ module Solargraph
22
22
  @location = location
23
23
  end
24
24
 
25
+ def path
26
+ code_object.nil? ? label : code_object.path
27
+ end
28
+
25
29
  def to_s
26
30
  label
27
31
  end
@@ -32,6 +36,7 @@ module Solargraph
32
36
  kind: @kind,
33
37
  insert: @insert,
34
38
  detail: @detail,
39
+ path: path,
35
40
  location: (@location.nil? ? nil : @location.to_s)
36
41
  }
37
42
  if @code_object.nil?
@@ -1,3 +1,3 @@
1
1
  module Solargraph
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -6,10 +6,10 @@ module Solargraph
6
6
 
7
7
  class YardMap
8
8
  def initialize required: [], workspace: nil
9
- #unless workspace.nil?
10
- # wsy = File.join(workspace, '.yardoc')
11
- # yardocs.push wsy if File.exist?(wsy)
12
- #end
9
+ unless workspace.nil?
10
+ wsy = File.join(workspace, '.yardoc')
11
+ yardocs.push wsy if File.exist?(wsy)
12
+ end
13
13
  used = []
14
14
  required.each { |r|
15
15
  if workspace.nil? or !File.exist?(File.join workspace, 'lib', "#{r}.rb")
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.0
4
+ version: 0.5.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: 2017-04-10 00:00:00.000000000 Z
11
+ date: 2017-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser