solargraph 0.24.0 → 0.24.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
  SHA256:
3
- metadata.gz: 102d3ab02b96835a5e3efc7a5ec5f07b2bd53c94660d16905f6c7264e6ac520a
4
- data.tar.gz: 29aab3c067c6e9e95eeb5cf108ae5f71560f325aa02612bb69957840706e9d43
3
+ metadata.gz: c068cbe7c4d090f33124e8a8ab52a9f956992aab3c5db9e5f41ba41f65642be3
4
+ data.tar.gz: 1798f2d5c48fa1d794c7441102154d464ce4cb8a75ea77d759c9eea27dbfc492
5
5
  SHA512:
6
- metadata.gz: eed6ec2beee0afb8bcb8fc976f1d1487b5d79cd44acc1c27c89751f896da3ede2f8ec33da4d14278ea597e3308c3770cf6952d57dabf19de67d759b0a1464c1a
7
- data.tar.gz: c7e7b79cf903a07e1237598a3d0f645aff86602128703af72531ee12d8bb7c1bf85a9445a097aec9f90ac8bd5dab9a9fcb24aa95fc6935250f24d017e8b85872
6
+ metadata.gz: 1aac2a042e292cf73c3bb70559b9a67d7a0d1c75537f669b20cfffd1bb1a41a820c67f9c4a845e23bce24cc5f1384a3dad7055a91b138f910ff4099633834f3f
7
+ data.tar.gz: f204e7cbee66ffa0e5a5d0a0086e8415e222a13a576b6a394ca840cf5a7f9401fe9570953db9770274262b1524b820f17c020c711b65c9dac1cc44b157d464dc
@@ -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
@@ -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
- namespace, scope = extract_namespace_and_scope(type)
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
@@ -40,7 +40,7 @@ module Solargraph
40
40
  items.push pin.completion_item.merge({
41
41
  textEdit: {
42
42
  range: completion.range.to_hash,
43
- newText: pin.name
43
+ newText: pin.name.sub(/=$/, ' = ')
44
44
  },
45
45
  sortText: "#{pin.name}#{idx.to_s.rjust(4, '0')}"
46
46
  })
@@ -100,7 +100,7 @@ module Solargraph
100
100
  #
101
101
  # @return [String]
102
102
  def return_scope
103
- return nil if complex_types.empty?
103
+ return nil if return_complex_types.empty?
104
104
  @return_scope ||= return_complex_types.first.scope
105
105
  end
106
106
 
@@ -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 = nil
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 = nil
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
@@ -1,3 +1,3 @@
1
1
  module Solargraph
2
- VERSION = '0.24.0'
2
+ VERSION = '0.24.1'
3
3
  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.24.0
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-07 00:00:00.000000000 Z
11
+ date: 2018-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser