solargraph 0.55.3 → 0.55.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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/typecheck.yml +1 -1
  3. data/CHANGELOG.md +4 -1
  4. data/lib/solargraph/api_map/store.rb +6 -3
  5. data/lib/solargraph/api_map.rb +97 -30
  6. data/lib/solargraph/complex_type/type_methods.rb +1 -0
  7. data/lib/solargraph/complex_type/unique_type.rb +3 -2
  8. data/lib/solargraph/doc_map.rb +3 -3
  9. data/lib/solargraph/gem_pins.rb +2 -1
  10. data/lib/solargraph/language_server/host.rb +2 -1
  11. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +1 -0
  12. data/lib/solargraph/logging.rb +1 -0
  13. data/lib/solargraph/parser/comment_ripper.rb +1 -0
  14. data/lib/solargraph/parser/flow_sensitive_typing.rb +2 -1
  15. data/lib/solargraph/parser/node_processor.rb +3 -1
  16. data/lib/solargraph/parser/parser_gem/node_methods.rb +1 -1
  17. data/lib/solargraph/parser/parser_gem/node_processors/alias_node.rb +2 -1
  18. data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +4 -2
  19. data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +4 -2
  20. data/lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb +2 -1
  21. data/lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb +2 -1
  22. data/lib/solargraph/parser/parser_gem/node_processors/def_node.rb +6 -3
  23. data/lib/solargraph/parser/parser_gem/node_processors/defs_node.rb +2 -1
  24. data/lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb +2 -1
  25. data/lib/solargraph/parser/parser_gem/node_processors/ivasgn_node.rb +4 -2
  26. data/lib/solargraph/parser/parser_gem/node_processors/lvasgn_node.rb +2 -1
  27. data/lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb +4 -2
  28. data/lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb +2 -1
  29. data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +4 -3
  30. data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +28 -16
  31. data/lib/solargraph/parser/parser_gem/node_processors/sym_node.rb +2 -1
  32. data/lib/solargraph/parser/parser_gem/node_processors/until_node.rb +1 -0
  33. data/lib/solargraph/parser/parser_gem/node_processors/while_node.rb +1 -0
  34. data/lib/solargraph/parser/region.rb +1 -1
  35. data/lib/solargraph/pin/base.rb +27 -4
  36. data/lib/solargraph/pin/callable.rb +5 -3
  37. data/lib/solargraph/pin/closure.rb +6 -1
  38. data/lib/solargraph/pin/common.rb +5 -0
  39. data/lib/solargraph/pin/delegated_method.rb +2 -0
  40. data/lib/solargraph/pin/documenting.rb +16 -0
  41. data/lib/solargraph/pin/keyword.rb +7 -2
  42. data/lib/solargraph/pin/method.rb +14 -9
  43. data/lib/solargraph/pin/namespace.rb +7 -2
  44. data/lib/solargraph/pin/parameter.rb +4 -0
  45. data/lib/solargraph/pin/proxy_type.rb +3 -3
  46. data/lib/solargraph/pin/reference/override.rb +10 -6
  47. data/lib/solargraph/pin/reference/require.rb +2 -2
  48. data/lib/solargraph/pin/signature.rb +4 -0
  49. data/lib/solargraph/pin/singleton.rb +1 -1
  50. data/lib/solargraph/pin/symbol.rb +3 -2
  51. data/lib/solargraph/pin.rb +1 -1
  52. data/lib/solargraph/rbs_map/conversions.rb +164 -48
  53. data/lib/solargraph/rbs_map/core_fills.rb +24 -15
  54. data/lib/solargraph/rbs_map/core_map.rb +3 -2
  55. data/lib/solargraph/shell.rb +1 -0
  56. data/lib/solargraph/source/chain/array.rb +7 -4
  57. data/lib/solargraph/source/chain/block_symbol.rb +1 -1
  58. data/lib/solargraph/source/chain/block_variable.rb +1 -1
  59. data/lib/solargraph/source/chain/call.rb +8 -7
  60. data/lib/solargraph/source/chain/hash.rb +1 -1
  61. data/lib/solargraph/source/chain/head.rb +1 -1
  62. data/lib/solargraph/source/chain/if.rb +1 -1
  63. data/lib/solargraph/source/chain/literal.rb +2 -2
  64. data/lib/solargraph/source/chain/or.rb +1 -1
  65. data/lib/solargraph/source/chain.rb +2 -2
  66. data/lib/solargraph/source_map/mapper.rb +9 -5
  67. data/lib/solargraph/version.rb +1 -1
  68. data/lib/solargraph/yard_map/mapper/to_constant.rb +4 -2
  69. data/lib/solargraph/yard_map/mapper/to_method.rb +14 -1
  70. data/lib/solargraph/yard_map/mapper/to_namespace.rb +4 -2
  71. data/lib/solargraph/yard_map/mapper.rb +4 -3
  72. data/lib/solargraph/yard_map/to_method.rb +4 -2
  73. data/lib/solargraph.rb +19 -0
  74. data/rbs/fills/tuple.rbs +150 -0
  75. metadata +3 -2
@@ -34,7 +34,7 @@ module Solargraph
34
34
  return if process_private_class_method
35
35
  end
36
36
  elsif node.children[1] == :require && node.children[0].to_s == '(const nil :Bundler)'
37
- pins.push Pin::Reference::Require.new(Solargraph::Location.new(region.filename, Solargraph::Range.from_to(0, 0, 0, 0)), 'bundler/require')
37
+ pins.push Pin::Reference::Require.new(Solargraph::Location.new(region.filename, Solargraph::Range.from_to(0, 0, 0, 0)), 'bundler/require', source: :parser)
38
38
  end
39
39
  process_children
40
40
  end
@@ -76,7 +76,8 @@ module Solargraph
76
76
  comments: cmnt,
77
77
  scope: region.scope || :instance,
78
78
  visibility: region.visibility,
79
- attribute: true
79
+ attribute: true,
80
+ source: :parser
80
81
  )
81
82
  end
82
83
  if node.children[1] == :attr_writer || node.children[1] == :attr_accessor
@@ -87,10 +88,11 @@ module Solargraph
87
88
  comments: cmnt,
88
89
  scope: region.scope || :instance,
89
90
  visibility: region.visibility,
90
- attribute: true
91
+ attribute: true,
92
+ source: :parser
91
93
  )
92
94
  pins.push method_pin
93
- method_pin.parameters.push Pin::Parameter.new(name: 'value', decl: :arg, closure: pins.last)
95
+ method_pin.parameters.push Pin::Parameter.new(name: 'value', decl: :arg, closure: pins.last, source: :parser)
94
96
  if method_pin.return_type.defined?
95
97
  pins.last.docstring.add_tag YARD::Tags::Tag.new(:param, '', pins.last.return_type.items.map(&:rooted_tags), 'value')
96
98
  end
@@ -107,7 +109,8 @@ module Solargraph
107
109
  pins.push type.new(
108
110
  location: get_node_location(i),
109
111
  closure: cp,
110
- name: unpack_name(i)
112
+ name: unpack_name(i),
113
+ source: :parser
111
114
  )
112
115
  end
113
116
  end
@@ -121,7 +124,8 @@ module Solargraph
121
124
  pins.push Pin::Reference::Prepend.new(
122
125
  location: get_node_location(i),
123
126
  closure: cp,
124
- name: unpack_name(i)
127
+ name: unpack_name(i),
128
+ source: :parser
125
129
  )
126
130
  end
127
131
  end
@@ -135,13 +139,15 @@ module Solargraph
135
139
  pins.push Pin::Reference::Extend.new(
136
140
  location: loc,
137
141
  closure: region.closure,
138
- name: region.closure.full_context.namespace
142
+ name: region.closure.full_context.namespace,
143
+ source: :parser
139
144
  )
140
145
  else
141
146
  pins.push Pin::Reference::Extend.new(
142
147
  location: loc,
143
148
  closure: region.closure,
144
- name: unpack_name(i)
149
+ name: unpack_name(i),
150
+ source: :parser
145
151
  )
146
152
  end
147
153
  end
@@ -151,7 +157,7 @@ module Solargraph
151
157
  def process_require
152
158
  if node.children[2].is_a?(AST::Node) && node.children[2].type == :str
153
159
  path = node.children[2].children[0].to_s
154
- pins.push Pin::Reference::Require.new(get_node_location(node), path)
160
+ pins.push Pin::Reference::Require.new(get_node_location(node), path, source: :parser)
155
161
  end
156
162
  end
157
163
 
@@ -159,7 +165,7 @@ module Solargraph
159
165
  def process_autoload
160
166
  if node.children[3].is_a?(AST::Node) && node.children[3].type == :str
161
167
  path = node.children[3].children[0].to_s
162
- pins.push Pin::Reference::Require.new(get_node_location(node), path)
168
+ pins.push Pin::Reference::Require.new(get_node_location(node), path, source: :parser)
163
169
  end
164
170
  end
165
171
 
@@ -171,7 +177,8 @@ module Solargraph
171
177
  elsif node.children[2].type == :sym || node.children[2].type == :str
172
178
  node.children[2..-1].each do |x|
173
179
  cn = x.children[0].to_s
174
- ref = pins.select{ |p| p.is_a?(Pin::Method) && p.namespace == region.closure.full_context.namespace && p.name == cn }.first
180
+ # @type [Pin::Method]
181
+ ref = pins.find { |p| p.is_a?(Pin::Method) && p.namespace == region.closure.full_context.namespace && p.name == cn }
175
182
  unless ref.nil?
176
183
  pins.delete ref
177
184
  mm = Solargraph::Pin::Method.new(
@@ -182,7 +189,8 @@ module Solargraph
182
189
  comments: ref.comments,
183
190
  scope: :class,
184
191
  visibility: :public,
185
- node: ref.node
192
+ node: ref.node,
193
+ source: :parser
186
194
  )
187
195
  cm = Solargraph::Pin::Method.new(
188
196
  location: ref.location,
@@ -192,7 +200,8 @@ module Solargraph
192
200
  comments: ref.comments,
193
201
  scope: :instance,
194
202
  visibility: :private,
195
- node: ref.node)
203
+ node: ref.node,
204
+ source: :parser)
196
205
  pins.push mm, cm
197
206
  pins.select{|pin| pin.is_a?(Pin::InstanceVariable) && pin.closure.path == ref.path}.each do |ivar|
198
207
  pins.delete ivar
@@ -201,14 +210,16 @@ module Solargraph
201
210
  closure: cm,
202
211
  name: ivar.name,
203
212
  comments: ivar.comments,
204
- assignment: ivar.assignment
213
+ assignment: ivar.assignment,
214
+ source: :parser
205
215
  )
206
216
  pins.push Solargraph::Pin::InstanceVariable.new(
207
217
  location: ivar.location,
208
218
  closure: mm,
209
219
  name: ivar.name,
210
220
  comments: ivar.comments,
211
- assignment: ivar.assignment
221
+ assignment: ivar.assignment,
222
+ source: :parser
212
223
  )
213
224
  end
214
225
  end
@@ -236,7 +247,8 @@ module Solargraph
236
247
  closure: region.closure,
237
248
  name: node.children[2].children[0].to_s,
238
249
  original: node.children[3].children[0].to_s,
239
- scope: region.scope || :instance
250
+ scope: region.scope || :instance,
251
+ source: :parser
240
252
  )
241
253
  end
242
254
 
@@ -8,7 +8,8 @@ module Solargraph
8
8
  def process
9
9
  pins.push Solargraph::Pin::Symbol.new(
10
10
  get_node_location(node),
11
- ":#{node.children[0]}"
11
+ ":#{node.children[0]}",
12
+ source: :parser
12
13
  )
13
14
  end
14
15
  end
@@ -18,6 +18,7 @@ module Solargraph
18
18
  closure: region.closure,
19
19
  node: node,
20
20
  comments: comments_for(node),
21
+ source: :parser,
21
22
  )
22
23
  process_children region
23
24
  end
@@ -18,6 +18,7 @@ module Solargraph
18
18
  closure: region.closure,
19
19
  node: node,
20
20
  comments: comments_for(node),
21
+ source: :parser,
21
22
  )
22
23
  process_children region
23
24
  end
@@ -29,7 +29,7 @@ module Solargraph
29
29
  scope: nil, visibility: :public, lvars: []
30
30
  @source = source
31
31
  # @closure = closure
32
- @closure = closure || Pin::Namespace.new(name: '', location: source.location)
32
+ @closure = closure || Pin::Namespace.new(name: '', location: source.location, source: :parser)
33
33
  @scope = scope
34
34
  @visibility = visibility
35
35
  @lvars = lvars
@@ -41,9 +41,13 @@ module Solargraph
41
41
  @type_location = type_location
42
42
  @closure = closure
43
43
  @name = name
44
- @source = source
45
44
  @comments = comments
46
45
  @source = source
46
+ assert_source_provided
47
+ end
48
+
49
+ def assert_source_provided
50
+ Solargraph.assert_or_log(:source, "source not provided - #{@path} #{@source} #{self.class}") if source.nil?
47
51
  end
48
52
 
49
53
  # @return [String]
@@ -299,14 +303,33 @@ module Solargraph
299
303
  end
300
304
 
301
305
  # @return [String]
302
- def desc
306
+ def inner_desc
303
307
  closure_info = closure&.desc
304
308
  binder_info = binder&.desc
305
- "[name=#{name.inspect} return_type=#{type_desc}, context=#{context.rooted_tags}, closure=#{closure_info}, binder=#{binder_info}]"
309
+ "name=#{name.inspect} return_type=#{type_desc}, context=#{context.rooted_tags}, closure=#{closure_info}, binder=#{binder_info}"
310
+ end
311
+
312
+ def desc
313
+ "[#{inner_desc}]"
306
314
  end
307
315
 
308
316
  def inspect
309
- "#<#{self.class} `#{self.desc}` at #{self.location.inspect}>"
317
+ "#<#{self.class} `#{self.inner_desc}`#{all_location_text} via #{source.inspect}>"
318
+ end
319
+
320
+ def all_location_text
321
+ if location.nil? && type_location.nil?
322
+ ''
323
+ elsif !location.nil? && type_location.nil?
324
+ " at #{location.inspect})"
325
+ elsif !type_location.nil? && location.nil?
326
+ " at #{type_location.inspect})"
327
+ else
328
+ " at (#{location.inspect} and #{type_location.inspect})"
329
+ end
330
+ end
331
+
332
+ def reset_generated!
310
333
  end
311
334
 
312
335
  protected
@@ -6,7 +6,7 @@ module Solargraph
6
6
  # @return [Signature]
7
7
  attr_reader :block
8
8
 
9
- attr_reader :parameters
9
+ attr_accessor :parameters
10
10
 
11
11
  # @return [ComplexType, nil]
12
12
  attr_reader :return_type
@@ -21,6 +21,10 @@ module Solargraph
21
21
  @parameters = parameters
22
22
  end
23
23
 
24
+ def method_namespace
25
+ closure.namespace
26
+ end
27
+
24
28
  # @return [::Array<String>]
25
29
  def parameter_names
26
30
  @parameter_names ||= parameters.map(&:name)
@@ -140,8 +144,6 @@ module Solargraph
140
144
  protected
141
145
 
142
146
  attr_writer :block
143
-
144
- attr_writer :parameters
145
147
  end
146
148
  end
147
149
  end
@@ -8,10 +8,15 @@ module Solargraph
8
8
 
9
9
  # @param scope [::Symbol] :class or :instance
10
10
  # @param generics [::Array<Pin::Parameter>, nil]
11
- def initialize scope: :class, generics: nil, **splat
11
+ def initialize scope: :class, generics: nil, generic_defaults: {}, **splat
12
12
  super(**splat)
13
13
  @scope = scope
14
14
  @generics = generics
15
+ @generic_defaults = generic_defaults
16
+ end
17
+
18
+ def generic_defaults
19
+ @generic_defaults ||= {}
15
20
  end
16
21
 
17
22
  def context
@@ -9,6 +9,11 @@ module Solargraph
9
9
  # @return [Pin::Closure, nil]
10
10
  attr_reader :closure
11
11
 
12
+ def closure
13
+ Solargraph.assert_or_log(:closure, "Closure not set on #{self.class} #{name.inspect} from #{source.inspect}") unless @closure
14
+ @closure
15
+ end
16
+
12
17
  # @return [String]
13
18
  def name
14
19
  @name ||= ''
@@ -43,6 +43,7 @@ module Solargraph
43
43
 
44
44
  %i[comments parameters return_type signatures].each do |method|
45
45
  define_method(method) do
46
+ # @sg-ignore Need to set context correctly in define_method blocks
46
47
  @resolved_method ? @resolved_method.send(method) : super()
47
48
  end
48
49
  end
@@ -51,6 +52,7 @@ module Solargraph
51
52
  # @param api_map [ApiMap]
52
53
  define_method(method) do |api_map|
53
54
  resolve_method(api_map)
55
+ # @sg-ignore Need to set context correctly in define_method blocks
54
56
  @resolved_method ? @resolved_method.send(method, api_map) : super(api_map)
55
57
  end
56
58
  end
@@ -9,6 +9,22 @@ require 'solargraph/converters/dt'
9
9
  require 'solargraph/converters/dd'
10
10
  require 'solargraph/converters/misc'
11
11
 
12
+ # @todo upstream this definition
13
+
14
+ # @!parse
15
+ # module ::Kramdown
16
+ # class Document
17
+ # # @return [String]
18
+ # def to_html; end
19
+ # end
20
+ # end
21
+ # module ReverseMarkdown
22
+ # # @param input [String]
23
+ # # @param options [Hash]
24
+ # # @return [String]
25
+ # def self.convert(input, options = {}); end
26
+ # end
27
+
12
28
  module Solargraph
13
29
  module Pin
14
30
  # A module to add the Pin::Base#documentation method.
@@ -3,8 +3,13 @@
3
3
  module Solargraph
4
4
  module Pin
5
5
  class Keyword < Base
6
- def initialize name
7
- super(name: name)
6
+ def initialize(name, **kwargs)
7
+ # @sg-ignore "Unrecognized keyword argument kwargs to Solargraph::Pin::Base#initialize"
8
+ super(name: name, **kwargs)
9
+ end
10
+
11
+ def closure
12
+ @closure ||= Pin::ROOT_PIN
8
13
  end
9
14
 
10
15
  def name
@@ -10,6 +10,8 @@ module Solargraph
10
10
  # @return [::Symbol] :public, :private, or :protected
11
11
  attr_reader :visibility
12
12
 
13
+ attr_writer :signatures
14
+
13
15
  # @return [Parser::AST::Node]
14
16
  attr_reader :node
15
17
 
@@ -116,13 +118,16 @@ module Solargraph
116
118
  name: name,
117
119
  decl: decl,
118
120
  presence: location ? location.range : nil,
119
- return_type: ComplexType.try_parse(*p.types)
121
+ return_type: ComplexType.try_parse(*p.types),
122
+ source: source
120
123
  )
121
124
  end
122
125
  yield_return_type = ComplexType.try_parse(*yieldreturn_tags.flat_map(&:types))
123
- block = Signature.new(generics: generics, parameters: yield_parameters, return_type: yield_return_type)
126
+ block = Signature.new(generics: generics, parameters: yield_parameters, return_type: yield_return_type, source: source)
124
127
  end
125
- Signature.new(generics: generics, parameters: parameters, return_type: return_type, block: block)
128
+ signature = Signature.new(generics: generics, parameters: parameters, return_type: return_type, block: block, closure: self, source: source)
129
+ block.closure = signature if block
130
+ signature
126
131
  end
127
132
 
128
133
  # @return [::Array<Signature>]
@@ -163,7 +168,7 @@ module Solargraph
163
168
  end
164
169
  end
165
170
 
166
- def desc
171
+ def inner_desc
167
172
  # ensure the signatures line up when logged
168
173
  if signatures.length > 1
169
174
  path + " \n#{to_rbs}\n"
@@ -304,10 +309,12 @@ module Solargraph
304
309
  name: name,
305
310
  decl: decl,
306
311
  presence: location ? location.range : nil,
307
- return_type: param_type_from_name(tag, src.first)
312
+ return_type: param_type_from_name(tag, src.first),
313
+ source: :overloads
308
314
  )
309
315
  end,
310
- return_type: ComplexType.try_parse(*tag.docstring.tags(:return).flat_map(&:types))
316
+ return_type: ComplexType.try_parse(*tag.docstring.tags(:return).flat_map(&:types)),
317
+ source: :overloads,
311
318
  )
312
319
  end
313
320
  @overloads
@@ -344,8 +351,6 @@ module Solargraph
344
351
 
345
352
  attr_writer :block
346
353
 
347
- attr_writer :signatures
348
-
349
354
  attr_writer :signature_help
350
355
 
351
356
  attr_writer :documentation
@@ -523,7 +528,7 @@ module Solargraph
523
528
 
524
529
  protected
525
530
 
526
- attr_writer :signatures
531
+ attr_writer :return_type
527
532
  end
528
533
  end
529
534
  end
@@ -11,6 +11,11 @@ module Solargraph
11
11
  # @return [::Symbol] :class or :module
12
12
  attr_reader :type
13
13
 
14
+ # does not assert like super, as a namespace without a closure
15
+ # may be the root level namespace, or it may not yet be
16
+ # qualified
17
+ attr_reader :closure
18
+
14
19
  # @param type [::Symbol] :class or :module
15
20
  # @param visibility [::Symbol] :public or :private
16
21
  # @param gates [::Array<String>]
@@ -37,7 +42,7 @@ module Solargraph
37
42
  closure.full_context.namespace + '::'
38
43
  end
39
44
  closure_name += parts.join('::')
40
- @closure = Pin::Namespace.new(name: closure_name, gates: [parts.join('::')])
45
+ @closure = Pin::Namespace.new(name: closure_name, gates: [parts.join('::')], source: :namespace)
41
46
  @context = nil
42
47
  end
43
48
  @name = name
@@ -47,7 +52,7 @@ module Solargraph
47
52
  "#{@type.to_s} #{return_type.all_params.first.to_rbs}#{rbs_generics}".strip
48
53
  end
49
54
 
50
- def desc
55
+ def inner_desc
51
56
  if name.nil? || name.empty?
52
57
  '(top-level)'
53
58
  else
@@ -9,6 +9,10 @@ module Solargraph
9
9
  # @return [String]
10
10
  attr_reader :asgn_code
11
11
 
12
+ # allow this to be set to the method after the method itself has
13
+ # been created
14
+ attr_writer :closure
15
+
12
16
  # @param decl [::Symbol] :arg, :optarg, :kwarg, :kwoptarg, :restarg, :kwrestarg, :block, :blockarg
13
17
  # @param asgn_code [String, nil]
14
18
  def initialize decl: :arg, asgn_code: nil, **splat
@@ -18,16 +18,16 @@ module Solargraph
18
18
  # @param closure [Pin::Namespace, nil] Used as the closure for this pin
19
19
  # @param binder [ComplexType, ComplexType::UniqueType, nil]
20
20
  # @return [ProxyType]
21
- def self.anonymous context, closure: nil, binder: nil
21
+ def self.anonymous context, closure: nil, binder: nil, **kwargs
22
22
  unless closure
23
23
  parts = context.namespace.split('::')
24
24
  namespace = parts[0..-2].join('::').to_s
25
- closure = Solargraph::Pin::Namespace.new(name: namespace)
25
+ closure = Solargraph::Pin::Namespace.new(name: namespace, source: :proxy_type)
26
26
  end
27
27
  # name = parts.last.to_s
28
28
  # ProxyType.new(nil, namespace, name, return_type)
29
29
  ProxyType.new(
30
- closure: closure, return_type: context, binder: binder || context
30
+ closure: closure, return_type: context, binder: binder || context, **kwargs
31
31
  )
32
32
  end
33
33
  end
@@ -10,18 +10,22 @@ module Solargraph
10
10
  # @return [::Array<Symbol>]
11
11
  attr_reader :delete
12
12
 
13
- def initialize location, name, tags, delete = []
14
- super(location: location, name: name)
13
+ def closure
14
+ nil
15
+ end
16
+
17
+ def initialize location, name, tags, delete = [], **splat
18
+ super(location: location, name: name, **splat)
15
19
  @tags = tags
16
20
  @delete = delete
17
21
  end
18
22
 
19
- def self.method_return name, *tags, delete: []
20
- new(nil, name, [YARD::Tags::Tag.new('return', nil, tags)], delete)
23
+ def self.method_return name, *tags, delete: [], **splat
24
+ new(nil, name, [YARD::Tags::Tag.new('return', nil, tags)], delete, **splat)
21
25
  end
22
26
 
23
- def self.from_comment name, comment
24
- new(nil, name, Solargraph::Source.parse_docstring(comment).to_docstring.tags)
27
+ def self.from_comment name, comment, **splat
28
+ new(nil, name, Solargraph::Source.parse_docstring(comment).to_docstring.tags, **splat)
25
29
  end
26
30
  end
27
31
  end
@@ -4,9 +4,9 @@ module Solargraph
4
4
  module Pin
5
5
  class Reference
6
6
  class Require < Reference
7
- def initialize location, name
7
+ def initialize location, name, **splat
8
8
  # super(location, '', name)
9
- super(location: location, name: name)
9
+ super(location: location, name: name, closure: Pin::ROOT_PIN, **splat)
10
10
  end
11
11
  end
12
12
  end
@@ -1,6 +1,10 @@
1
1
  module Solargraph
2
2
  module Pin
3
3
  class Signature < Callable
4
+ # allow signature to be created before method pin, then set this
5
+ # to the method pin
6
+ attr_writer :closure
7
+
4
8
  def initialize **splat
5
9
  super(**splat)
6
10
  end
@@ -3,7 +3,7 @@
3
3
  module Solargraph
4
4
  module Pin
5
5
  class Singleton < Closure
6
- def initialize name: '', location: nil, closure: nil
6
+ def initialize name: '', location: nil, closure: nil, **splat
7
7
  super
8
8
  end
9
9
  end
@@ -5,8 +5,9 @@ module Solargraph
5
5
  class Symbol < Base
6
6
  # @param location [Solargraph::Location]
7
7
  # @param name [String]
8
- def initialize location, name
9
- super(location: location, name: name)
8
+ def initialize(location, name, **kwargs)
9
+ # @sg-ignore "Unrecognized keyword argument kwargs to Solargraph::Pin::Base#initialize"
10
+ super(location: location, name: name, **kwargs)
10
11
  # @name = name
11
12
  # @location = location
12
13
  end
@@ -39,6 +39,6 @@ module Solargraph
39
39
  autoload :While, 'solargraph/pin/while'
40
40
  autoload :Callable, 'solargraph/pin/callable'
41
41
 
42
- ROOT_PIN = Pin::Namespace.new(type: :class, name: '', closure: nil)
42
+ ROOT_PIN = Pin::Namespace.new(type: :class, name: '', closure: nil, source: :pin_rb)
43
43
  end
44
44
  end