solargraph 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solargraph/api_map.rb +4 -2
- data/lib/solargraph/code_map.rb +25 -9
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/yard_map.rb +21 -17
- 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: bc699f1c3abc5198bf2fde325bb4dfde8c6cb384
|
4
|
+
data.tar.gz: 6f676543082c9943d647772d3c4c7f04ab4caefe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d519c282a68e56c063068d03a1d7067e98d544714e5b234b5f5da08c6b2e354fcc0067240bf6630eeeeb94b02cf57c1461715054b241febfe73217b53e6e3129
|
7
|
+
data.tar.gz: 57e7b7388f4aca96e654a1997cd8d236227f9ebb76f7b4d118ca2fe5e3e015955c583889693e683e81f37e978b5d8c5781d218b2e18af17e6d88262f7bde5f12
|
data/lib/solargraph/api_map.rb
CHANGED
@@ -346,7 +346,7 @@ module Solargraph
|
|
346
346
|
unless p == 'new' and scope != :instance
|
347
347
|
if scope == :instance
|
348
348
|
meths = get_instance_methods(type)
|
349
|
-
meths += get_methods('') if top
|
349
|
+
meths += get_methods('') if top or type.to_s == ''
|
350
350
|
else
|
351
351
|
meths = get_methods(type)
|
352
352
|
#meths += get_methods('') if top
|
@@ -544,7 +544,9 @@ module Solargraph
|
|
544
544
|
if n.kind_of?(AST::Node)
|
545
545
|
if n.type == :class and !n.children[1].nil?
|
546
546
|
s = unpack_name(n.children[1])
|
547
|
-
|
547
|
+
# @todo This skip might not work properly. We might need to get a
|
548
|
+
# fully qualified namespace from it first
|
549
|
+
meths += get_instance_methods(s, namespace) unless skip.include?(s)
|
548
550
|
end
|
549
551
|
current_scope = :public
|
550
552
|
n.children.each { |c|
|
data/lib/solargraph/code_map.rb
CHANGED
@@ -41,21 +41,34 @@ module Solargraph
|
|
41
41
|
STDERR.puts "Retrying..."
|
42
42
|
tries += 1
|
43
43
|
spot = e.diagnostic.location.begin_pos
|
44
|
+
#STDERR.puts "CODE>>>>"
|
45
|
+
#STDERR.puts tmp
|
46
|
+
#STDERR.puts "<<<<CODE"
|
47
|
+
#STDERR.puts "Spot #{spot}: #{tmp[spot]}"
|
48
|
+
repl = '_'
|
44
49
|
if tmp[spot] == '@' or tmp[spot] == ':'
|
45
50
|
# Stub unfinished instance variables and symbols
|
46
51
|
spot -= 1
|
47
52
|
elsif tmp[spot - 1] == '.'
|
48
53
|
# Stub unfinished method calls
|
54
|
+
repl = '#' if spot == tmp.length or tmp[spot] == '\n'
|
49
55
|
spot -= 2
|
50
56
|
else
|
51
57
|
# Stub the whole line
|
52
|
-
spot = beginning_of_line_from(spot)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
tmp = tmp[0..spot] + '#' + tmp[spot+2..-1].to_s
|
58
|
+
spot = beginning_of_line_from(tmp, spot)
|
59
|
+
repl = '#'
|
60
|
+
if tmp[spot+1..-1].rstrip == 'end'
|
61
|
+
repl= 'end;end'
|
62
|
+
end
|
58
63
|
end
|
64
|
+
#if spot == 0
|
65
|
+
# tmp = '#' + tmp[1..-1]
|
66
|
+
#else
|
67
|
+
tmp = tmp[0..spot] + repl + tmp[spot+repl.length+1..-1].to_s
|
68
|
+
#end
|
69
|
+
#STDERR.puts "CHNG>>>>"
|
70
|
+
#STDERR.puts tmp
|
71
|
+
#STDERR.puts "<<<<CHNG"
|
59
72
|
retry
|
60
73
|
end
|
61
74
|
raise e
|
@@ -227,7 +240,7 @@ module Solargraph
|
|
227
240
|
end
|
228
241
|
end
|
229
242
|
end
|
230
|
-
result = reduce_starting_with(result, word_at(index)) if filtered
|
243
|
+
#result = reduce_starting_with(result, word_at(index)) if filtered
|
231
244
|
result.uniq{|s| s.path}
|
232
245
|
end
|
233
246
|
|
@@ -432,10 +445,13 @@ module Solargraph
|
|
432
445
|
nil
|
433
446
|
end
|
434
447
|
|
435
|
-
def beginning_of_line_from i
|
436
|
-
while i > 0 and
|
448
|
+
def beginning_of_line_from str, i
|
449
|
+
while i > 0 and str[i] != "\n"
|
437
450
|
i -= 1
|
438
451
|
end
|
452
|
+
if i > 0 and str[i..-1].strip == ''
|
453
|
+
i = beginning_of_line_from str, i -1
|
454
|
+
end
|
439
455
|
i
|
440
456
|
end
|
441
457
|
end
|
data/lib/solargraph/version.rb
CHANGED
data/lib/solargraph/yard_map.rb
CHANGED
@@ -21,7 +21,11 @@ module Solargraph
|
|
21
21
|
unless used.include?(g)
|
22
22
|
used.push g
|
23
23
|
gy = YARD::Registry.yardoc_file_for_gem(g)
|
24
|
-
|
24
|
+
if gy.nil?
|
25
|
+
STDERR.puts "Required path not found: #{r}"
|
26
|
+
else
|
27
|
+
yardocs.push gy
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
27
31
|
}
|
@@ -81,20 +85,10 @@ module Solargraph
|
|
81
85
|
cached = cache.get_constants(namespace, scope)
|
82
86
|
return cached unless cached.nil?
|
83
87
|
consts = []
|
84
|
-
binds = []
|
85
88
|
result = []
|
86
89
|
yardocs.each { |y|
|
87
90
|
yard = load_yardoc(y)
|
88
91
|
unless yard.nil?
|
89
|
-
if namespace == '' and scope == ''
|
90
|
-
# Check for a bind tag in the yardoc root. If it exists, treat
|
91
|
-
# workspace code as a DSL that uses public instance methods in the
|
92
|
-
# specified namespaces.
|
93
|
-
b = yard.root.tag(:bind)
|
94
|
-
unless b.nil?
|
95
|
-
binds.concat b.types
|
96
|
-
end
|
97
|
-
end
|
98
92
|
ns = nil
|
99
93
|
if scope == ''
|
100
94
|
ns = yard.at(namespace)
|
@@ -116,9 +110,6 @@ module Solargraph
|
|
116
110
|
end
|
117
111
|
result.push Suggestion.new(c.to_s.split('::').last, detail: detail, kind: kind)
|
118
112
|
}
|
119
|
-
binds.each { |type|
|
120
|
-
result.concat get_instance_methods(type, '', visibility: [:public])
|
121
|
-
}
|
122
113
|
cache.set_constants(namespace, scope, result)
|
123
114
|
result
|
124
115
|
end
|
@@ -150,11 +141,19 @@ module Solargraph
|
|
150
141
|
cached = cache.get_methods(namespace, scope, visibility)
|
151
142
|
return cached unless cached.nil?
|
152
143
|
meths = []
|
144
|
+
binds = []
|
153
145
|
yardocs.each { |y|
|
154
146
|
yard = load_yardoc(y)
|
155
147
|
unless yard.nil?
|
156
148
|
ns = nil
|
157
149
|
ns = find_first_resolved_namespace(yard, namespace, scope)
|
150
|
+
if namespace == '' and scope == ''
|
151
|
+
# Check for a bind tag in the yardoc root. If it exists, treat
|
152
|
+
# workspace code as a DSL that uses public instance methods in the
|
153
|
+
# specified namespaces.
|
154
|
+
b = yard.root.tag(:bind)
|
155
|
+
binds.concat b.types unless b.nil?
|
156
|
+
end
|
158
157
|
unless ns.nil?
|
159
158
|
ns.meths(scope: :class, visibility: visibility).each { |m|
|
160
159
|
n = m.to_s.split(/[\.#]/).last.gsub(/=/, ' = ')
|
@@ -173,6 +172,9 @@ module Solargraph
|
|
173
172
|
end
|
174
173
|
end
|
175
174
|
}
|
175
|
+
binds.each { |b|
|
176
|
+
meths += get_instance_methods(b, scope, visibility: [:public])
|
177
|
+
}
|
176
178
|
cache.set_methods(namespace, scope, visibility, meths)
|
177
179
|
meths
|
178
180
|
end
|
@@ -198,7 +200,9 @@ module Solargraph
|
|
198
200
|
end
|
199
201
|
}
|
200
202
|
if ns.kind_of?(YARD::CodeObjects::ClassObject) and namespace != 'Object'
|
201
|
-
|
203
|
+
if ns.superclass.kind_of?(YARD::CodeObjects::Proxy)
|
204
|
+
meths += get_instance_methods(ns.superclass.to_s)
|
205
|
+
end
|
202
206
|
end
|
203
207
|
end
|
204
208
|
end
|
@@ -254,8 +258,8 @@ module Solargraph
|
|
254
258
|
def cache_core
|
255
259
|
c = get_constants '', ''
|
256
260
|
c.each { |n|
|
257
|
-
get_methods
|
258
|
-
get_instance_methods
|
261
|
+
#get_methods n.label, visibility: :public
|
262
|
+
#get_instance_methods n.label, visibility: :public
|
259
263
|
}
|
260
264
|
end
|
261
265
|
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.7.
|
4
|
+
version: 0.7.5
|
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-05-
|
11
|
+
date: 2017-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|