solargraph 0.21.0 → 0.22.0
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 +5 -5
- data/lib/solargraph/api_map/completion.rb +3 -0
- data/lib/solargraph/api_map/probe.rb +21 -45
- data/lib/solargraph/api_map/store.rb +6 -2
- data/lib/solargraph/api_map/type_methods.rb +40 -0
- data/lib/solargraph/api_map.rb +45 -35
- data/lib/solargraph/diagnostics/require_not_found.rb +5 -0
- data/lib/solargraph/diagnostics/rubocop.rb +9 -0
- data/lib/solargraph/diagnostics.rb +5 -0
- data/lib/solargraph/language_server/host.rb +9 -1
- data/lib/solargraph/language_server/message/base.rb +1 -8
- data/lib/solargraph/language_server/message/extended/check_gem_version.rb +5 -1
- data/lib/solargraph/language_server/message/extended/download_core.rb +25 -0
- data/lib/solargraph/language_server/message/extended.rb +1 -0
- data/lib/solargraph/language_server/message/initialize.rb +3 -1
- data/lib/solargraph/language_server/message/text_document/definition.rb +1 -1
- data/lib/solargraph/language_server/message/text_document/hover.rb +1 -1
- data/lib/solargraph/language_server/message/text_document/references.rb +14 -0
- data/lib/solargraph/language_server/message/text_document/rename.rb +17 -0
- data/lib/solargraph/language_server/message/text_document.rb +13 -11
- data/lib/solargraph/language_server/message.rb +3 -0
- data/lib/solargraph/language_server/request.rb +4 -0
- data/lib/solargraph/language_server/transport/socket.rb +4 -4
- data/lib/solargraph/language_server/uri_helpers.rb +2 -0
- data/lib/solargraph/library.rb +37 -0
- data/lib/solargraph/live_map/cache.rb +7 -0
- data/lib/solargraph/live_map.rb +8 -2
- data/lib/solargraph/pin/attribute.rb +5 -1
- data/lib/solargraph/pin/namespace.rb +0 -2
- data/lib/solargraph/pin/proxy_method.rb +31 -0
- data/lib/solargraph/pin.rb +1 -0
- data/lib/solargraph/plugin/process.rb +1 -1
- data/lib/solargraph/plugin/runtime.rb +6 -3
- data/lib/solargraph/shell.rb +0 -1
- data/lib/solargraph/source/flawed_builder.rb +3 -0
- data/lib/solargraph/source/fragment.rb +12 -15
- data/lib/solargraph/source/location.rb +3 -0
- data/lib/solargraph/source/mapper.rb +60 -18
- data/lib/solargraph/source/node_methods.rb +111 -0
- data/lib/solargraph/source/position.rb +18 -0
- data/lib/solargraph/source/range.rb +5 -1
- data/lib/solargraph/source.rb +31 -1
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/workspace/config.rb +6 -2
- data/lib/solargraph/workspace.rb +7 -1
- data/lib/solargraph/yard_map/core_docs.rb +1 -1
- data/lib/solargraph/yard_map.rb +43 -5
- data/lib/solargraph.rb +0 -1
- metadata +27 -8
- data/lib/solargraph/node_methods.rb +0 -101
|
@@ -16,6 +16,7 @@ module Solargraph
|
|
|
16
16
|
# Get a hash of the position. This representation is suitable for use in
|
|
17
17
|
# the language server protocol.
|
|
18
18
|
#
|
|
19
|
+
# @return [Hash]
|
|
19
20
|
def to_hash
|
|
20
21
|
{
|
|
21
22
|
line: line,
|
|
@@ -23,6 +24,11 @@ module Solargraph
|
|
|
23
24
|
}
|
|
24
25
|
end
|
|
25
26
|
|
|
27
|
+
# Get a numeric offset for the specified text and position.
|
|
28
|
+
#
|
|
29
|
+
# @param text [String]
|
|
30
|
+
# @param position [Position]
|
|
31
|
+
# @return [Integer]
|
|
26
32
|
def self.to_offset text, position
|
|
27
33
|
result = 0
|
|
28
34
|
feed = 0
|
|
@@ -41,10 +47,22 @@ module Solargraph
|
|
|
41
47
|
result
|
|
42
48
|
end
|
|
43
49
|
|
|
50
|
+
# Get a numeric offset for the specified text and a position identified
|
|
51
|
+
# by its line and character.
|
|
52
|
+
#
|
|
53
|
+
# @param text [String]
|
|
54
|
+
# @param line [Integer]
|
|
55
|
+
# @param character [Integer]
|
|
56
|
+
# @return [Integer]
|
|
44
57
|
def self.line_char_to_offset text, line, character
|
|
45
58
|
to_offset(text, Position.new(line, character))
|
|
46
59
|
end
|
|
47
60
|
|
|
61
|
+
# Get a position for the specified text and offset.
|
|
62
|
+
#
|
|
63
|
+
# @param text [String]
|
|
64
|
+
# @param offset [Integer]
|
|
65
|
+
# @return [Position]
|
|
48
66
|
def self.from_offset text, offset
|
|
49
67
|
cursor = 0
|
|
50
68
|
line = 0
|
|
@@ -17,6 +17,7 @@ module Solargraph
|
|
|
17
17
|
# Get a hash of the range. This representation is suitable for use in
|
|
18
18
|
# the language server protocol.
|
|
19
19
|
#
|
|
20
|
+
# @return [Hash<Symbol, Position>]
|
|
20
21
|
def to_hash
|
|
21
22
|
{
|
|
22
23
|
start: start.to_hash,
|
|
@@ -24,6 +25,9 @@ module Solargraph
|
|
|
24
25
|
}
|
|
25
26
|
end
|
|
26
27
|
|
|
28
|
+
# True if the specified position is inside the range.
|
|
29
|
+
#
|
|
30
|
+
# @return [Boolean]
|
|
27
31
|
def contain? position
|
|
28
32
|
return false if position.line < start.line
|
|
29
33
|
return false if position.line == start.line and position.character < start.character
|
|
@@ -38,7 +42,7 @@ module Solargraph
|
|
|
38
42
|
# @param c1 [Integer] Starting character
|
|
39
43
|
# @param l2 [Integer] Ending line
|
|
40
44
|
# @param c2 [Integer] Ending character
|
|
41
|
-
# @return [
|
|
45
|
+
# @return [Range]
|
|
42
46
|
def self.from_to l1, c1, l2, c2
|
|
43
47
|
Range.new(Position.new(l1, c1), Position.new(l2, c2))
|
|
44
48
|
end
|
data/lib/solargraph/source.rb
CHANGED
|
@@ -11,6 +11,7 @@ module Solargraph
|
|
|
11
11
|
autoload :Updater, 'solargraph/source/updater'
|
|
12
12
|
autoload :Change, 'solargraph/source/change'
|
|
13
13
|
autoload :Mapper, 'solargraph/source/mapper'
|
|
14
|
+
autoload :NodeMethods, 'solargraph/source/node_methods'
|
|
14
15
|
|
|
15
16
|
# @return [String]
|
|
16
17
|
attr_reader :code
|
|
@@ -40,6 +41,7 @@ module Solargraph
|
|
|
40
41
|
# @return [Time]
|
|
41
42
|
attr_reader :stime
|
|
42
43
|
|
|
44
|
+
# @return [Array<Solargraph::Pin::Base>]
|
|
43
45
|
attr_reader :pins
|
|
44
46
|
|
|
45
47
|
attr_reader :requires
|
|
@@ -132,6 +134,22 @@ module Solargraph
|
|
|
132
134
|
symbol_pins
|
|
133
135
|
end
|
|
134
136
|
|
|
137
|
+
# @return [Array<Source::Location>]
|
|
138
|
+
def references name
|
|
139
|
+
inner_node_references(name, node).map do |n|
|
|
140
|
+
offset = Position.to_offset(code, get_node_start_position(n))
|
|
141
|
+
soff = code.index(name, offset)
|
|
142
|
+
eoff = soff + name.length
|
|
143
|
+
Location.new(
|
|
144
|
+
filename,
|
|
145
|
+
Solargraph::Source::Range.new(
|
|
146
|
+
Position.from_offset(code, soff),
|
|
147
|
+
Position.from_offset(code, eoff)
|
|
148
|
+
)
|
|
149
|
+
)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
135
153
|
def locate_named_path_pin line, character
|
|
136
154
|
_locate_pin line, character, Pin::NAMESPACE, Pin::METHOD
|
|
137
155
|
end
|
|
@@ -157,7 +175,8 @@ module Solargraph
|
|
|
157
175
|
|
|
158
176
|
# Get the nearest node that contains the specified index.
|
|
159
177
|
#
|
|
160
|
-
# @param
|
|
178
|
+
# @param line [Integer]
|
|
179
|
+
# @param column [Integer]
|
|
161
180
|
# @return [AST::Node]
|
|
162
181
|
def node_at(line, column)
|
|
163
182
|
tree_at(line, column).first
|
|
@@ -246,6 +265,17 @@ module Solargraph
|
|
|
246
265
|
|
|
247
266
|
private
|
|
248
267
|
|
|
268
|
+
def inner_node_references name, top
|
|
269
|
+
result = []
|
|
270
|
+
if top.kind_of?(AST::Node)
|
|
271
|
+
if (top.type == :const and top.children[1].to_s == name) or (top.type == :send and top.children[1].to_s == name)
|
|
272
|
+
result.push top
|
|
273
|
+
end
|
|
274
|
+
top.children.each { |c| result.concat inner_node_references(name, c) }
|
|
275
|
+
end
|
|
276
|
+
result
|
|
277
|
+
end
|
|
278
|
+
|
|
249
279
|
def parse
|
|
250
280
|
node, comments = inner_parse(@fixed, filename)
|
|
251
281
|
@node = node
|
data/lib/solargraph/version.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Solargraph
|
|
|
13
13
|
def initialize workspace = nil
|
|
14
14
|
@workspace = workspace
|
|
15
15
|
include_globs = ['**/*.rb']
|
|
16
|
-
exclude_globs = ['spec/**/*', 'test/**/*', 'vendor/**/*']
|
|
16
|
+
exclude_globs = ['spec/**/*', 'test/**/*', 'vendor/**/*', '.bundle/**/*']
|
|
17
17
|
unless @workspace.nil?
|
|
18
18
|
sfile = File.join(@workspace, '.solargraph.yml')
|
|
19
19
|
if File.file?(sfile)
|
|
@@ -44,7 +44,7 @@ module Solargraph
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# An array of files excluded from the workspace.
|
|
47
|
-
#
|
|
47
|
+
#
|
|
48
48
|
# @return [Array<String>]
|
|
49
49
|
def excluded
|
|
50
50
|
return [] if workspace.nil?
|
|
@@ -67,6 +67,10 @@ module Solargraph
|
|
|
67
67
|
raw_data['require']
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
def require_paths
|
|
71
|
+
raw_data['require_paths'] || []
|
|
72
|
+
end
|
|
73
|
+
|
|
70
74
|
def plugins
|
|
71
75
|
raw_data['plugins']
|
|
72
76
|
end
|
data/lib/solargraph/workspace.rb
CHANGED
|
@@ -132,15 +132,21 @@ module Solargraph
|
|
|
132
132
|
|
|
133
133
|
def generate_require_paths
|
|
134
134
|
return [] if directory.nil?
|
|
135
|
-
return
|
|
135
|
+
return configured_require_paths unless gemspec?
|
|
136
136
|
result = []
|
|
137
137
|
gemspecs.each do |file|
|
|
138
138
|
spec = Gem::Specification.load(file)
|
|
139
139
|
base = File.dirname(file)
|
|
140
140
|
result.concat spec.require_paths.map{ |path| File.join(base, path) } unless spec.nil?
|
|
141
141
|
end
|
|
142
|
+
result.concat config.require_paths
|
|
142
143
|
result.push File.join(directory, 'lib') if result.empty?
|
|
143
144
|
result
|
|
144
145
|
end
|
|
146
|
+
|
|
147
|
+
def configured_require_paths
|
|
148
|
+
return [File.join(directory, 'lib')] if config.require_paths.empty?
|
|
149
|
+
config.require_paths.map{|p| File.join(directory, p)}
|
|
150
|
+
end
|
|
145
151
|
end
|
|
146
152
|
end
|
|
@@ -77,7 +77,7 @@ module Solargraph
|
|
|
77
77
|
|
|
78
78
|
def download version
|
|
79
79
|
FileUtils.mkdir_p cache_dir
|
|
80
|
-
uri = URI.parse("
|
|
80
|
+
uri = URI.parse("#{SOURCE}/#{version}.tar.gz")
|
|
81
81
|
response = Net::HTTP.get_response(uri)
|
|
82
82
|
zipfile = File.join(cache_dir, "#{version}.tar.gz")
|
|
83
83
|
File.binwrite zipfile, response.body
|
data/lib/solargraph/yard_map.rb
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
require 'yard'
|
|
2
2
|
|
|
3
3
|
module Solargraph
|
|
4
|
+
# The YardMap provides access to YARD documentation for the Ruby core, the
|
|
5
|
+
# stdlib, and gems.
|
|
6
|
+
#
|
|
4
7
|
class YardMap
|
|
5
8
|
autoload :Cache, 'solargraph/yard_map/cache'
|
|
6
9
|
autoload :CoreDocs, 'solargraph/yard_map/core_docs'
|
|
7
10
|
|
|
8
11
|
CoreDocs.require_minimum
|
|
9
12
|
@@stdlib_yardoc = CoreDocs.yard_stdlib_file
|
|
10
|
-
@@
|
|
13
|
+
@@stdlib_paths = {}
|
|
11
14
|
YARD::Registry.load! @@stdlib_yardoc
|
|
12
15
|
YARD::Registry.all(:class, :module).each do |ns|
|
|
13
|
-
|
|
16
|
+
next if ns.file.nil?
|
|
17
|
+
path = ns.file.sub(/^(ext|lib)\//, '').sub(/\.(rb|c)$/, '')
|
|
18
|
+
next if path.start_with?('-')
|
|
19
|
+
@@stdlib_paths[path] ||= []
|
|
20
|
+
@@stdlib_paths[path].push ns
|
|
14
21
|
end
|
|
15
22
|
|
|
16
23
|
# @return [Solargraph::Workspace]
|
|
@@ -25,6 +32,7 @@ module Solargraph
|
|
|
25
32
|
@required = required.clone
|
|
26
33
|
@namespace_yardocs = {}
|
|
27
34
|
@gem_paths = {}
|
|
35
|
+
@stdlib_namespaces = []
|
|
28
36
|
process_requires
|
|
29
37
|
yardocs.push CoreDocs.yardoc_file
|
|
30
38
|
yardocs.uniq!
|
|
@@ -99,12 +107,16 @@ module Solargraph
|
|
|
99
107
|
result = []
|
|
100
108
|
combined_namespaces(namespace, scope).each do |ns|
|
|
101
109
|
yardocs_documenting(ns).each do |y|
|
|
110
|
+
# @todo Getting constants from the stdlib works slightly differently
|
|
111
|
+
# from methods
|
|
112
|
+
next if y == @@stdlib_yardoc
|
|
102
113
|
yard = load_yardoc(y)
|
|
103
114
|
unless yard.nil?
|
|
104
115
|
found = yard.at(ns)
|
|
105
116
|
consts.concat found.children unless found.nil?
|
|
106
117
|
end
|
|
107
118
|
end
|
|
119
|
+
consts.concat @stdlib_namespaces.select{|ns| ns.namespace.path == namespace}
|
|
108
120
|
end
|
|
109
121
|
consts.each { |c|
|
|
110
122
|
detail = nil
|
|
@@ -140,9 +152,20 @@ module Solargraph
|
|
|
140
152
|
ns = nil
|
|
141
153
|
ns = find_first_resolved_object(yard, namespace, scope)
|
|
142
154
|
unless ns.nil?
|
|
155
|
+
has_new = false
|
|
143
156
|
ns.meths(scope: :class, visibility: visibility).each { |m|
|
|
157
|
+
has_new = true if m.name == 'new'
|
|
144
158
|
meths.push Pin::YardObject.new(m, object_location(m))
|
|
145
159
|
}
|
|
160
|
+
# HACK: Convert #initialize to .new
|
|
161
|
+
if visibility.include?(:public) and !has_new
|
|
162
|
+
init = ns.meths(scope: :instance).select{|m| m.to_s.split(/[\.#]/).last == 'initialize'}.first
|
|
163
|
+
unless init.nil?
|
|
164
|
+
ip = Solargraph::Pin::YardObject.new(init, object_location(init))
|
|
165
|
+
np = Solargraph::Pin::Method.new(ip.location, ip.namespace, 'new', ip.docstring, :class, :public, ip.parameters)
|
|
166
|
+
meths.push np
|
|
167
|
+
end
|
|
168
|
+
end
|
|
146
169
|
# Collect superclass methods
|
|
147
170
|
if ns.kind_of?(YARD::CodeObjects::ClassObject) and !ns.superclass.nil?
|
|
148
171
|
meths += get_methods ns.superclass.to_s, '', visibility: [:public, :protected] unless ['Object', 'BasicObject', ''].include?(ns.superclass.to_s)
|
|
@@ -170,6 +193,8 @@ module Solargraph
|
|
|
170
193
|
unless ns.nil?
|
|
171
194
|
ns.meths(scope: :instance, visibility: visibility).each do |m|
|
|
172
195
|
n = m.to_s.split(/[\.#]/).last
|
|
196
|
+
# HACK: Exception for Module#module_function in Class
|
|
197
|
+
next if ns.name == :Class and m.path == 'Module#module_function'
|
|
173
198
|
# HACK: Special treatment for #initialize
|
|
174
199
|
next if n == 'initialize' and !visibility.include?(:private)
|
|
175
200
|
if (namespace == 'Kernel' or !m.to_s.start_with?('Kernel#')) and !m.docstring.to_s.include?(':nodoc:')
|
|
@@ -203,10 +228,12 @@ module Solargraph
|
|
|
203
228
|
while parts.length > 0
|
|
204
229
|
here = "#{parts.join('::')}::#{namespace}"
|
|
205
230
|
return here unless yardocs_documenting(here).empty?
|
|
231
|
+
return here if @stdlib_namespaces.any?{|ns| ns.path == here}
|
|
206
232
|
parts.pop
|
|
207
233
|
end
|
|
208
234
|
end
|
|
209
235
|
return namespace unless yardocs_documenting(namespace).empty?
|
|
236
|
+
return namespace if @stdlib_namespaces.any?{|ns| ns.path == namespace}
|
|
210
237
|
nil
|
|
211
238
|
end
|
|
212
239
|
|
|
@@ -221,6 +248,9 @@ module Solargraph
|
|
|
221
248
|
end
|
|
222
249
|
end
|
|
223
250
|
}
|
|
251
|
+
@stdlib_namespaces.each do |ns|
|
|
252
|
+
result.push Pin::YardObject.new(ns, object_location(ns)) if ns.path == path
|
|
253
|
+
end
|
|
224
254
|
result
|
|
225
255
|
end
|
|
226
256
|
|
|
@@ -266,19 +296,25 @@ module Solargraph
|
|
|
266
296
|
tried = []
|
|
267
297
|
unresolved_requires.clear
|
|
268
298
|
required.each do |r|
|
|
299
|
+
next if r.nil?
|
|
300
|
+
next if !workspace.nil? and workspace.would_require?(r)
|
|
269
301
|
begin
|
|
270
302
|
spec = Gem::Specification.find_by_path(r) || Gem::Specification.find_by_name(r.split('/').first)
|
|
271
303
|
ver = spec.version.to_s
|
|
272
304
|
ver = ">= 0" if ver.empty?
|
|
273
305
|
add_gem_dependencies spec
|
|
274
|
-
next if !workspace.nil? and workspace.would_require?(r)
|
|
275
306
|
yd = YARD::Registry.yardoc_file_for_gem(spec.name, ver)
|
|
276
307
|
@gem_paths[spec.name] = spec.full_gem_path
|
|
277
308
|
unresolved_requires.push r if yd.nil?
|
|
278
309
|
yardocs.unshift yd unless yd.nil? or yardocs.include?(yd)
|
|
279
310
|
rescue Gem::LoadError => e
|
|
280
311
|
next if !workspace.nil? and workspace.would_require?(r)
|
|
281
|
-
|
|
312
|
+
stdnames = []
|
|
313
|
+
@@stdlib_paths.each_pair do |path, objects|
|
|
314
|
+
stdnames.concat objects if path == r or path.start_with?("#{r}/")
|
|
315
|
+
end
|
|
316
|
+
@stdlib_namespaces.concat stdnames
|
|
317
|
+
unresolved_requires.push r if stdnames.empty?
|
|
282
318
|
end
|
|
283
319
|
end
|
|
284
320
|
end
|
|
@@ -315,7 +351,9 @@ module Solargraph
|
|
|
315
351
|
else
|
|
316
352
|
result.concat @namespace_yardocs[namespace] unless @namespace_yardocs[namespace].nil?
|
|
317
353
|
end
|
|
318
|
-
|
|
354
|
+
if @stdlib_namespaces.map(&:path).include?(namespace)
|
|
355
|
+
result.push @@stdlib_yardoc
|
|
356
|
+
end
|
|
319
357
|
result
|
|
320
358
|
end
|
|
321
359
|
|
data/lib/solargraph.rb
CHANGED
|
@@ -20,7 +20,6 @@ module Solargraph
|
|
|
20
20
|
autoload :Shell, 'solargraph/shell'
|
|
21
21
|
autoload :Source, 'solargraph/source'
|
|
22
22
|
autoload :ApiMap, 'solargraph/api_map'
|
|
23
|
-
autoload :NodeMethods, 'solargraph/node_methods'
|
|
24
23
|
autoload :YardMap, 'solargraph/yard_map'
|
|
25
24
|
autoload :Pin, 'solargraph/pin'
|
|
26
25
|
autoload :LiveMap, 'solargraph/live_map'
|
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.
|
|
4
|
+
version: 0.22.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fred Snyder
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-05-
|
|
11
|
+
date: 2018-05-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: parser
|
|
@@ -102,16 +102,16 @@ dependencies:
|
|
|
102
102
|
name: kramdown
|
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
|
104
104
|
requirements:
|
|
105
|
-
- - "
|
|
105
|
+
- - "~>"
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
|
-
version: '
|
|
107
|
+
version: '1.16'
|
|
108
108
|
type: :runtime
|
|
109
109
|
prerelease: false
|
|
110
110
|
version_requirements: !ruby/object:Gem::Requirement
|
|
111
111
|
requirements:
|
|
112
|
-
- - "
|
|
112
|
+
- - "~>"
|
|
113
113
|
- !ruby/object:Gem::Version
|
|
114
|
-
version: '
|
|
114
|
+
version: '1.16'
|
|
115
115
|
- !ruby/object:Gem::Dependency
|
|
116
116
|
name: htmlentities
|
|
117
117
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -208,6 +208,20 @@ dependencies:
|
|
|
208
208
|
- - "~>"
|
|
209
209
|
- !ruby/object:Gem::Version
|
|
210
210
|
version: '0.14'
|
|
211
|
+
- !ruby/object:Gem::Dependency
|
|
212
|
+
name: pry
|
|
213
|
+
requirement: !ruby/object:Gem::Requirement
|
|
214
|
+
requirements:
|
|
215
|
+
- - "~>"
|
|
216
|
+
- !ruby/object:Gem::Version
|
|
217
|
+
version: 0.11.3
|
|
218
|
+
type: :development
|
|
219
|
+
prerelease: false
|
|
220
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
221
|
+
requirements:
|
|
222
|
+
- - "~>"
|
|
223
|
+
- !ruby/object:Gem::Version
|
|
224
|
+
version: 0.11.3
|
|
211
225
|
description: IDE tools for code completion and inline documentation
|
|
212
226
|
email: admin@castwide.com
|
|
213
227
|
executables:
|
|
@@ -226,6 +240,7 @@ files:
|
|
|
226
240
|
- lib/solargraph/api_map/probe.rb
|
|
227
241
|
- lib/solargraph/api_map/source_to_yard.rb
|
|
228
242
|
- lib/solargraph/api_map/store.rb
|
|
243
|
+
- lib/solargraph/api_map/type_methods.rb
|
|
229
244
|
- lib/solargraph/core_fills.rb
|
|
230
245
|
- lib/solargraph/diagnostics.rb
|
|
231
246
|
- lib/solargraph/diagnostics/base.rb
|
|
@@ -248,6 +263,7 @@ files:
|
|
|
248
263
|
- lib/solargraph/language_server/message/extended/check_gem_version.rb
|
|
249
264
|
- lib/solargraph/language_server/message/extended/document.rb
|
|
250
265
|
- lib/solargraph/language_server/message/extended/document_gems.rb
|
|
266
|
+
- lib/solargraph/language_server/message/extended/download_core.rb
|
|
251
267
|
- lib/solargraph/language_server/message/extended/search.rb
|
|
252
268
|
- lib/solargraph/language_server/message/initialize.rb
|
|
253
269
|
- lib/solargraph/language_server/message/initialized.rb
|
|
@@ -266,6 +282,8 @@ files:
|
|
|
266
282
|
- lib/solargraph/language_server/message/text_document/formatting.rb
|
|
267
283
|
- lib/solargraph/language_server/message/text_document/hover.rb
|
|
268
284
|
- lib/solargraph/language_server/message/text_document/on_type_formatting.rb
|
|
285
|
+
- lib/solargraph/language_server/message/text_document/references.rb
|
|
286
|
+
- lib/solargraph/language_server/message/text_document/rename.rb
|
|
269
287
|
- lib/solargraph/language_server/message/text_document/signature_help.rb
|
|
270
288
|
- lib/solargraph/language_server/message/workspace.rb
|
|
271
289
|
- lib/solargraph/language_server/message/workspace/did_change_configuration.rb
|
|
@@ -281,7 +299,6 @@ files:
|
|
|
281
299
|
- lib/solargraph/library.rb
|
|
282
300
|
- lib/solargraph/live_map.rb
|
|
283
301
|
- lib/solargraph/live_map/cache.rb
|
|
284
|
-
- lib/solargraph/node_methods.rb
|
|
285
302
|
- lib/solargraph/page.rb
|
|
286
303
|
- lib/solargraph/pin.rb
|
|
287
304
|
- lib/solargraph/pin/attribute.rb
|
|
@@ -303,6 +320,7 @@ files:
|
|
|
303
320
|
- lib/solargraph/pin/method_parameter.rb
|
|
304
321
|
- lib/solargraph/pin/namespace.rb
|
|
305
322
|
- lib/solargraph/pin/plugin/method.rb
|
|
323
|
+
- lib/solargraph/pin/proxy_method.rb
|
|
306
324
|
- lib/solargraph/pin/reference.rb
|
|
307
325
|
- lib/solargraph/pin/symbol.rb
|
|
308
326
|
- lib/solargraph/pin/yard_object.rb
|
|
@@ -319,6 +337,7 @@ files:
|
|
|
319
337
|
- lib/solargraph/source/fragment.rb
|
|
320
338
|
- lib/solargraph/source/location.rb
|
|
321
339
|
- lib/solargraph/source/mapper.rb
|
|
340
|
+
- lib/solargraph/source/node_methods.rb
|
|
322
341
|
- lib/solargraph/source/position.rb
|
|
323
342
|
- lib/solargraph/source/range.rb
|
|
324
343
|
- lib/solargraph/source/updater.rb
|
|
@@ -356,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
356
375
|
version: '0'
|
|
357
376
|
requirements: []
|
|
358
377
|
rubyforge_project:
|
|
359
|
-
rubygems_version: 2.
|
|
378
|
+
rubygems_version: 2.7.6
|
|
360
379
|
signing_key:
|
|
361
380
|
specification_version: 4
|
|
362
381
|
summary: Solargraph for Ruby
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
module Solargraph
|
|
2
|
-
module NodeMethods
|
|
3
|
-
# @return [String]
|
|
4
|
-
def unpack_name(node)
|
|
5
|
-
pack_name(node).join("::")
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
# @return [Array<String>]
|
|
9
|
-
def pack_name(node)
|
|
10
|
-
parts = []
|
|
11
|
-
if node.kind_of?(AST::Node)
|
|
12
|
-
node.children.each { |n|
|
|
13
|
-
if n.kind_of?(AST::Node)
|
|
14
|
-
if n.type == :cbase
|
|
15
|
-
parts = pack_name(n)
|
|
16
|
-
else
|
|
17
|
-
parts += pack_name(n)
|
|
18
|
-
end
|
|
19
|
-
else
|
|
20
|
-
parts.push n unless n.nil?
|
|
21
|
-
end
|
|
22
|
-
}
|
|
23
|
-
end
|
|
24
|
-
parts
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# @return [String]
|
|
28
|
-
def const_from node
|
|
29
|
-
if node.kind_of?(AST::Node) and node.type == :const
|
|
30
|
-
result = ''
|
|
31
|
-
unless node.children[0].nil?
|
|
32
|
-
result = const_from(node.children[0])
|
|
33
|
-
end
|
|
34
|
-
if result == ''
|
|
35
|
-
result = node.children[1].to_s
|
|
36
|
-
else
|
|
37
|
-
result = result + '::' + node.children[1].to_s
|
|
38
|
-
end
|
|
39
|
-
result
|
|
40
|
-
else
|
|
41
|
-
nil
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# @return [String]
|
|
46
|
-
def infer_literal_node_type node
|
|
47
|
-
return nil unless node.kind_of?(AST::Node)
|
|
48
|
-
if node.type == :str or node.type == :dstr
|
|
49
|
-
return 'String'
|
|
50
|
-
elsif node.type == :array
|
|
51
|
-
return 'Array'
|
|
52
|
-
elsif node.type == :hash
|
|
53
|
-
return 'Hash'
|
|
54
|
-
elsif node.type == :int
|
|
55
|
-
return 'Integer'
|
|
56
|
-
elsif node.type == :float
|
|
57
|
-
return 'Float'
|
|
58
|
-
elsif node.type == :sym
|
|
59
|
-
return 'Symbol'
|
|
60
|
-
# @todo Maybe ignore nils
|
|
61
|
-
# elsif node.type == :nil
|
|
62
|
-
# return 'NilClass'
|
|
63
|
-
end
|
|
64
|
-
nil
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
# Get a call signature from a node.
|
|
68
|
-
# The result should be a string in the form of a method path, e.g.,
|
|
69
|
-
# String.new or variable.method.
|
|
70
|
-
#
|
|
71
|
-
# @return [String]
|
|
72
|
-
def resolve_node_signature node
|
|
73
|
-
result = drill_signature node, ''
|
|
74
|
-
return nil if result.empty?
|
|
75
|
-
result
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
private
|
|
79
|
-
|
|
80
|
-
def drill_signature node, signature
|
|
81
|
-
return signature unless node.kind_of?(AST::Node)
|
|
82
|
-
if node.type == :const or node.type == :cbase
|
|
83
|
-
unless node.children[0].nil?
|
|
84
|
-
signature += drill_signature(node.children[0], signature)
|
|
85
|
-
end
|
|
86
|
-
signature += '::' unless signature.empty?
|
|
87
|
-
signature += node.children[1].to_s
|
|
88
|
-
elsif node.type == :lvar or node.type == :ivar or node.type == :cvar
|
|
89
|
-
signature += '.' unless signature.empty?
|
|
90
|
-
signature += node.children[0].to_s
|
|
91
|
-
elsif node.type == :send
|
|
92
|
-
unless node.children[0].nil?
|
|
93
|
-
signature += drill_signature(node.children[0], signature)
|
|
94
|
-
end
|
|
95
|
-
signature += '.' unless signature.empty?
|
|
96
|
-
signature += node.children[1].to_s
|
|
97
|
-
end
|
|
98
|
-
signature
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|