solargraph 0.3.0 → 0.3.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 +4 -4
- data/lib/solargraph/api_map.rb +2 -2
- data/lib/solargraph/code_map.rb +15 -7
- data/lib/solargraph/shell.rb +1 -1
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/yard_map.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c06a568d53f3c10d270e3bde6f54a675654ae12
|
4
|
+
data.tar.gz: 788a257e6d80a0a8587eebd539bf1cebed2afedc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7046e14bce46e04439da78451b6f7a3351fa97d5b184d2b55d67379b7d70c16ef1b699a8cec2bc194ffbfb3f8b6eb73d9bf7272b14698051b51250c8b74dbb2
|
7
|
+
data.tar.gz: ee12ed39ebaa7dc39104c12171ef80e92fb7a8984ec96cbf3f87d8ef6420299bfd5867ad01e461d378bb27485105878734bb909ca8c33554b5d635e0e468849a
|
data/lib/solargraph/api_map.rb
CHANGED
@@ -537,10 +537,10 @@ module Solargraph
|
|
537
537
|
elsif node.type == :send and node.children[1] == :include
|
538
538
|
children += node.children[0,3]
|
539
539
|
elsif node.type == :send and node.children[1] == :require
|
540
|
-
@required.push(node.children[2].children[0])
|
540
|
+
@required.push(node.children[2].children[0]) if node.children[2].children[0].kind_of?(String)
|
541
541
|
children += node.children[0, 3]
|
542
542
|
elsif node.type == :send and node.children[1] == :autoload
|
543
|
-
@required.push(node.children[3].children[0])
|
543
|
+
@required.push(node.children[3].children[0]) if node.children[3].children[0].kind_of?(String)
|
544
544
|
type = :require
|
545
545
|
children += node.children[1, 3]
|
546
546
|
elsif node.type == :send
|
data/lib/solargraph/code_map.rb
CHANGED
@@ -193,6 +193,7 @@ module Solargraph
|
|
193
193
|
parts.pop
|
194
194
|
end
|
195
195
|
result += @api_map.namespaces_in('')
|
196
|
+
result += @api_map.get_instance_methods('Kernel')
|
196
197
|
end
|
197
198
|
result = reduce_starting_with(result, word_at(index)) if filtered
|
198
199
|
result
|
@@ -206,14 +207,21 @@ module Solargraph
|
|
206
207
|
scope = parent_node_from(index, :class, :module, :def, :defs) || @node
|
207
208
|
var = find_local_variable_node(first, scope)
|
208
209
|
if var.nil?
|
209
|
-
if
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
obj = first
|
210
|
+
if ['STDERR','STDOUT','STDIN'].include?(first)
|
211
|
+
obj = 'IO'
|
212
|
+
if parts.length == 0
|
213
|
+
return @api_map.get_instance_methods('IO')
|
214
|
+
end
|
215
215
|
else
|
216
|
-
|
216
|
+
if parts.length == 0
|
217
|
+
return @api_map.get_methods(first, ns_here)
|
218
|
+
end
|
219
|
+
meth = parts.shift
|
220
|
+
if meth == 'new'
|
221
|
+
obj = first
|
222
|
+
else
|
223
|
+
obj = get_method_return_value first, ns_here, meth
|
224
|
+
end
|
217
225
|
end
|
218
226
|
while parts.length > 0
|
219
227
|
obj = get_instance_method_return_value obj, ns_here, parts.shift
|
data/lib/solargraph/shell.rb
CHANGED
@@ -3,6 +3,7 @@ require 'json'
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'rubygems/package'
|
5
5
|
require 'zlib'
|
6
|
+
require 'net/http'
|
6
7
|
|
7
8
|
module Solargraph
|
8
9
|
class Shell < Thor
|
@@ -14,7 +15,6 @@ module Solargraph
|
|
14
15
|
version_dir = File.join(cache_dir, '2.0.0')
|
15
16
|
unless File.exist?(version_dir) or options[:force]
|
16
17
|
FileUtils.mkdir_p cache_dir
|
17
|
-
require 'net/http'
|
18
18
|
puts 'Downloading 2.0.0...'
|
19
19
|
Net::HTTP.start(options[:host]) do |http|
|
20
20
|
resp = http.get("/2.0.0.tar.gz")
|
data/lib/solargraph/version.rb
CHANGED
data/lib/solargraph/yard_map.rb
CHANGED
@@ -21,6 +21,14 @@ module Solargraph
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
}
|
24
|
+
# TODO: Experimental loading of all gems
|
25
|
+
#Bundler.load.specs.each { |s|
|
26
|
+
# unless used.include?(s.name)
|
27
|
+
# used.push s.name
|
28
|
+
# gy = YARD::Registry.yardoc_file_for_gem(s.name)
|
29
|
+
# yardocs.push gy unless gy.nil?
|
30
|
+
# end
|
31
|
+
#}
|
24
32
|
yardocs.push File.join(Dir.home, '.solargraph', 'cache', '2.0.0', 'yardoc')
|
25
33
|
#yardocs.push File.join(Dir.home, '.solargraph', 'cache', '2.0.0', 'yardoc-stdlib')
|
26
34
|
yardocs.uniq!
|
@@ -93,9 +101,9 @@ module Solargraph
|
|
93
101
|
else
|
94
102
|
ns = yard.resolve(P(scope), namespace)
|
95
103
|
end
|
96
|
-
unless ns.nil?
|
104
|
+
unless ns.nil? or !ns.kind_of?(YARD::CodeObjects::NamespaceObject)
|
97
105
|
ns.meths(scope: :class, visibility: [:public]).each { |m|
|
98
|
-
n = m.to_s.split(
|
106
|
+
n = m.to_s.split(/[\.#]/).last
|
99
107
|
label = "#{n}"
|
100
108
|
args = get_method_args(m)
|
101
109
|
label += " #{args.join(', ')}" unless args.empty?
|
@@ -123,8 +131,8 @@ module Solargraph
|
|
123
131
|
end
|
124
132
|
unless ns.nil?
|
125
133
|
ns.meths(scope: :instance, visibility: [:public]).each { |m|
|
126
|
-
n = m.to_s.split(
|
127
|
-
if n.to_s.match(/^[a-z]/i) and !m.to_s.start_with?('Kernel#') and !m.docstring.to_s.include?(':nodoc:')
|
134
|
+
n = m.to_s.split(/[\.#]/).last
|
135
|
+
if n.to_s.match(/^[a-z]/i) and (namespace == 'Kernel' or !m.to_s.start_with?('Kernel#')) and !m.docstring.to_s.include?(':nodoc:')
|
128
136
|
label = "#{n}"
|
129
137
|
args = get_method_args(m)
|
130
138
|
label += " #{args.join(', ')}" unless args.empty?
|
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.3.
|
4
|
+
version: 0.3.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-03-
|
11
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|