solargraph 0.40.3 → 0.40.4

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: 8eaae0cf888e025f51bdbeea3c414f98e7014d416f58e23d29770b4969f1eb5a
4
- data.tar.gz: 4d0b4b1d24e81953aa819b83f318767e79ce7d6ed3cfb5f6e4b1fcf6a3b5ffc0
3
+ metadata.gz: eff7d664014ae6d25990957afb4328baafe88ff76ef892db8b3d50791860845e
4
+ data.tar.gz: 8038c884a63ce269f1a0faaf635e4c295fadd61c456ba2665c84a17b4f03a031
5
5
  SHA512:
6
- metadata.gz: 668db64477f7249ad2d9381292e19f4007a28d607eedfb96848bbb9efd55645ec78c705976e31f765d706c47f08243a322594ccf177f54c950432f565f286789
7
- data.tar.gz: e0986273bb88005f0471c5837f979507fd8f2d13b9d45c1717e6bd77c3ebfd42c746e87aaf41fdf0271007c31849f8622fe9e5a4974e8a35bd0d9f6a4b8e9e3c
6
+ metadata.gz: a7b95e2ba342b191642a1d5ea228243a60b9211f6c05cab2acf09ddcaab3efb25cef488ca910964e0ac1c32edacc2f0ced4eef09fa819b03d2919af4ac734ca7
7
+ data.tar.gz: 6990c07591d43fdb583484c00fc5221d228850fa75e12b5cd2632413a21c1984f634ce2655371d9be7016a035e23fe622469418779bf3285f03a087a38c394ae
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.40.4 - March 3, 2021
2
+ - Fix optarg and blockarg ordering
3
+ - Override specialization for #initialize
4
+ - Find definitions with cursor after double colon
5
+
1
6
  ## 0.40.3 - February 7, 2021
2
7
  - Simplify and allow to configure rubocop formatter (#403)
3
8
  - Type checker shows tag in param type errors (#398)
@@ -238,11 +238,16 @@ module Solargraph
238
238
  pins_by_class(Pin::Reference::Override).each do |ovr|
239
239
  pin = get_path_pins(ovr.name).first
240
240
  next if pin.nil?
241
+ new_pin = if pin.path.end_with?('#initialize')
242
+ get_path_pins(pin.path.sub(/#initialize/, '.new')).first
243
+ end
241
244
  (ovr.tags.map(&:tag_name) + ovr.delete).uniq.each do |tag|
242
245
  pin.docstring.delete_tags tag.to_sym
246
+ new_pin.docstring.delete_tags tag.to_sym if new_pin
243
247
  end
244
248
  ovr.tags.each do |tag|
245
249
  pin.docstring.add_tag(tag)
250
+ new_pin.docstring.add_tag(tag) if new_pin
246
251
  end
247
252
  end
248
253
  end
@@ -55,19 +55,19 @@ module Solargraph
55
55
  )
56
56
  region.closure.parameters.push locals.last
57
57
  end
58
- if node.children.last
59
- locals.push Solargraph::Pin::Parameter.new(
60
- location: region.closure.location,
61
- closure: region.closure,
62
- comments: comments_for(node),
63
- name: node.children.last.to_s,
64
- presence: region.closure.location.range,
65
- decl: :blockarg
66
- )
67
- region.closure.parameters.push locals.last
68
- end
69
58
  end
70
59
  process_children
60
+ if node.children.last
61
+ locals.push Solargraph::Pin::Parameter.new(
62
+ location: region.closure.location,
63
+ closure: region.closure,
64
+ comments: comments_for(node),
65
+ name: node.children.last.to_s,
66
+ presence: region.closure.location.range,
67
+ decl: :blockarg
68
+ )
69
+ region.closure.parameters.push locals.last
70
+ end
71
71
  end
72
72
 
73
73
  private
@@ -16,12 +16,7 @@ module Solargraph
16
16
  presence: region.closure.location.range,
17
17
  decl: :optarg
18
18
  )
19
- idx = region.closure.parameters.find_index { |par| par.decl != :arg }
20
- if idx
21
- region.closure.parameters.insert idx, locals.last
22
- else
23
- region.closure.parameters.push locals.last
24
- end
19
+ region.closure.parameters.push locals.last
25
20
  node.children[1] && NodeProcessor.process(node.children[1], region, pins, locals)
26
21
  end
27
22
  end
@@ -175,7 +175,7 @@ module Solargraph
175
175
  synced
176
176
  end
177
177
 
178
- # @param position [Position]
178
+ # @param position [Position, Array(Integer, Integer)]
179
179
  # @return [Source::Cursor]
180
180
  def cursor_at position
181
181
  Cursor.new(self, position)
@@ -64,7 +64,7 @@ module Solargraph
64
64
  elsif end_of_phrase.strip == '::'
65
65
  chain.links.push Chain::UNDEFINED_CONSTANT
66
66
  end
67
- elsif chain.links.last.is_a?(Source::Chain::Constant) && end_of_phrase.strip == '::'
67
+ elsif chain.links.last.is_a?(Source::Chain::Constant) && end_of_phrase.strip == '::' && !source.code[Position.to_offset(source.code, position)].match?(/[a-z]/i)
68
68
  chain.links.push Source::Chain::UNDEFINED_CONSTANT
69
69
  end
70
70
  chain
@@ -95,7 +95,7 @@ module Solargraph
95
95
  result.push Problem.new(pin.location, "Untyped method #{pin.path} could not be inferred")
96
96
  end
97
97
  elsif rules.validate_tags?
98
- unless pin.node.nil? || declared.void? || macro_pin?(pin) || abstract?(pin)
98
+ unless pin.node.nil? || declared.void? || virtual_pin?(pin) || abstract?(pin)
99
99
  inferred = pin.probe(api_map).self_to(pin.full_context.namespace)
100
100
  if inferred.undefined?
101
101
  unless rules.ignore_all_undefined? || external?(pin)
@@ -111,7 +111,7 @@ module Solargraph
111
111
  result
112
112
  end
113
113
 
114
- def macro_pin? pin
114
+ def virtual_pin? pin
115
115
  pin.location && source_map.source.comment_at?(pin.location.range.ending)
116
116
  end
117
117
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.40.3'
4
+ VERSION = '0.40.4'
5
5
  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.40.3
4
+ version: 0.40.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-07 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backport