solargraph 0.24.0 → 0.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solargraph.rb +3 -0
- data/lib/solargraph/api_map.rb +3 -2
- data/lib/solargraph/language_server/message/text_document/completion.rb +1 -1
- data/lib/solargraph/pin/base.rb +1 -1
- data/lib/solargraph/source.rb +7 -0
- data/lib/solargraph/source/mapper.rb +13 -27
- data/lib/solargraph/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c068cbe7c4d090f33124e8a8ab52a9f956992aab3c5db9e5f41ba41f65642be3
|
4
|
+
data.tar.gz: 1798f2d5c48fa1d794c7441102154d464ce4cb8a75ea77d759c9eea27dbfc492
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aac2a042e292cf73c3bb70559b9a67d7a0d1c75537f669b20cfffd1bb1a41a820c67f9c4a845e23bce24cc5f1384a3dad7055a91b138f910ff4099633834f3f
|
7
|
+
data.tar.gz: f204e7cbee66ffa0e5a5d0a0086e8415e222a13a576b6a394ca840cf5a7f9401fe9570953db9770274262b1524b820f17c020c711b65c9dac1cc44b157d464dc
|
data/lib/solargraph.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'yard'
|
1
2
|
require 'solargraph/version'
|
2
3
|
require 'rubygems/package'
|
3
4
|
require 'yard-solargraph'
|
@@ -44,3 +45,5 @@ module Solargraph
|
|
44
45
|
end
|
45
46
|
|
46
47
|
Solargraph::YardMap::CoreDocs.require_minimum
|
48
|
+
# Change YARD log IO to avoid sending unexpected messages to STDOUT
|
49
|
+
YARD::Logger.instance.io = STDERR
|
data/lib/solargraph/api_map.rb
CHANGED
@@ -338,8 +338,9 @@ module Solargraph
|
|
338
338
|
if result.empty?
|
339
339
|
pins.each do |pin|
|
340
340
|
type = pin.return_type
|
341
|
-
unless type.nil?
|
342
|
-
|
341
|
+
unless type.nil? or type == 'void'
|
342
|
+
docns, scope = extract_namespace_and_scope(type)
|
343
|
+
namespace = qualify(docns, pin.namespace)
|
343
344
|
result.concat get_methods(namespace, scope: scope)
|
344
345
|
break
|
345
346
|
end
|
data/lib/solargraph/pin/base.rb
CHANGED
data/lib/solargraph/source.rb
CHANGED
@@ -34,6 +34,7 @@ module Solargraph
|
|
34
34
|
|
35
35
|
attr_reader :path_macros
|
36
36
|
|
37
|
+
# @return [Integer]
|
37
38
|
attr_accessor :version
|
38
39
|
|
39
40
|
# Get the time of the last synchronization.
|
@@ -207,6 +208,8 @@ module Solargraph
|
|
207
208
|
end
|
208
209
|
|
209
210
|
# @param updater [Source::Updater]
|
211
|
+
# @param reparse [Boolean]
|
212
|
+
# @return [void]
|
210
213
|
def synchronize updater, reparse = true
|
211
214
|
raise 'Invalid synchronization' unless updater.filename == filename
|
212
215
|
original_code = @code
|
@@ -244,6 +247,8 @@ module Solargraph
|
|
244
247
|
}
|
245
248
|
end
|
246
249
|
|
250
|
+
# @param location [Solargraph::Source::Location]
|
251
|
+
# @return [Solargraph::Pin::Base]
|
247
252
|
def locate_pin location
|
248
253
|
return nil unless location.start_with?("#{filename}:")
|
249
254
|
@all_pins.select{|pin| pin.location == location}.first
|
@@ -256,6 +261,7 @@ module Solargraph
|
|
256
261
|
Fragment.new(self, line, column)
|
257
262
|
end
|
258
263
|
|
264
|
+
# @return [Boolean]
|
259
265
|
def parsed?
|
260
266
|
@parsed
|
261
267
|
end
|
@@ -297,6 +303,7 @@ module Solargraph
|
|
297
303
|
end
|
298
304
|
end
|
299
305
|
|
306
|
+
# @return [void]
|
300
307
|
def parse
|
301
308
|
node, comments = inner_parse(@fixed, filename)
|
302
309
|
@node = node
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
|
3
1
|
module Solargraph
|
4
2
|
class Source
|
5
3
|
# The Mapper generates pins and other data for Sources.
|
@@ -59,10 +57,12 @@ module Solargraph
|
|
59
57
|
frag.strip.gsub(/,$/, '')
|
60
58
|
end
|
61
59
|
|
60
|
+
# @return [String]
|
62
61
|
def filename
|
63
62
|
@filename
|
64
63
|
end
|
65
64
|
|
65
|
+
# @return [Array<Solargraph::Pin::Base>]
|
66
66
|
def pins
|
67
67
|
@pins ||= []
|
68
68
|
end
|
@@ -332,6 +332,8 @@ module Solargraph
|
|
332
332
|
nil
|
333
333
|
end
|
334
334
|
|
335
|
+
# @param node [Parser::AST::Node]
|
336
|
+
# @return [Solargraph::Source::Location]
|
335
337
|
def get_node_location(node)
|
336
338
|
if node.nil?
|
337
339
|
st = Position.new(0, 0)
|
@@ -342,8 +344,11 @@ module Solargraph
|
|
342
344
|
end
|
343
345
|
range = Range.new(st, en)
|
344
346
|
Location.new(filename, range)
|
345
|
-
end
|
347
|
+
end
|
346
348
|
|
349
|
+
# @param node [Parser::AST::Node]
|
350
|
+
# @param comments [Array]
|
351
|
+
# @return [Hash]
|
347
352
|
def associate_comments node, comments
|
348
353
|
return nil if comments.nil?
|
349
354
|
comment_hash = Parser::Source::Comment.associate_locations(node, comments)
|
@@ -366,8 +371,7 @@ module Solargraph
|
|
366
371
|
ctxt += "#{p[num..-1]}\n"
|
367
372
|
end
|
368
373
|
}
|
369
|
-
parse =
|
370
|
-
suppress_stdout { parse = YARD::Docstring.parser.parse(ctxt) }
|
374
|
+
parse = YARD::Docstring.parser.parse(ctxt)
|
371
375
|
unless parse.directives.empty?
|
372
376
|
@directives[k] ||= []
|
373
377
|
@directives[k].concat parse.directives
|
@@ -377,17 +381,19 @@ module Solargraph
|
|
377
381
|
yard_hash
|
378
382
|
end
|
379
383
|
|
384
|
+
# @param node [Parser::AST::Node]
|
385
|
+
# @return [Solargraph::Pin::Namespace]
|
380
386
|
def namespace_for(node)
|
381
387
|
position = Source::Position.new(node.loc.line - 1, node.loc.column)
|
382
388
|
@pins.select{|pin| pin.kind == Pin::NAMESPACE and pin.location.range.contain?(position)}.last
|
383
389
|
end
|
384
390
|
|
391
|
+
# @return [void]
|
385
392
|
def process_directives
|
386
393
|
@directives.each_pair do |k, v|
|
387
394
|
v.each do |d|
|
388
395
|
ns = namespace_for(k.node)
|
389
|
-
docstring =
|
390
|
-
suppress_stdout { docstring = YARD::Docstring.parser.parse(d.tag.text).to_docstring }
|
396
|
+
docstring = YARD::Docstring.parser.parse(d.tag.text).to_docstring
|
391
397
|
if d.tag.tag_name == 'attribute'
|
392
398
|
t = (d.tag.types.nil? || d.tag.types.empty?) ? nil : d.tag.types.flatten.join('')
|
393
399
|
if t.nil? or t.include?('r')
|
@@ -453,26 +459,6 @@ module Solargraph
|
|
453
459
|
}
|
454
460
|
args
|
455
461
|
end
|
456
|
-
|
457
|
-
# Suppress writing data to STDOUT during execution of a block.
|
458
|
-
#
|
459
|
-
# @example
|
460
|
-
# suppress_stdout { puts 'This will not get printed' }
|
461
|
-
#
|
462
|
-
def suppress_stdout
|
463
|
-
original_stdout = STDOUT.clone
|
464
|
-
# @todo It would be better to redirect to /dev/null or StringIO if
|
465
|
-
# there's a cross-platform solution for it.
|
466
|
-
tempfile = Tempfile.new('tmp')
|
467
|
-
STDOUT.reopen tempfile
|
468
|
-
begin
|
469
|
-
yield
|
470
|
-
ensure
|
471
|
-
STDOUT.reopen original_stdout
|
472
|
-
tempfile.close
|
473
|
-
tempfile.unlink
|
474
|
-
end
|
475
|
-
end
|
476
462
|
end
|
477
463
|
end
|
478
464
|
end
|
data/lib/solargraph/version.rb
CHANGED
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.24.
|
4
|
+
version: 0.24.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: 2018-08-
|
11
|
+
date: 2018-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|