ruby-lsp 0.16.7 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/VERSION +1 -1
  4. data/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +195 -18
  5. data/lib/ruby_indexer/lib/ruby_indexer/entry.rb +129 -12
  6. data/lib/ruby_indexer/lib/ruby_indexer/index.rb +333 -44
  7. data/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb +99 -0
  8. data/lib/ruby_indexer/ruby_indexer.rb +1 -0
  9. data/lib/ruby_indexer/test/classes_and_modules_test.rb +58 -11
  10. data/lib/ruby_indexer/test/configuration_test.rb +5 -6
  11. data/lib/ruby_indexer/test/constant_test.rb +9 -9
  12. data/lib/ruby_indexer/test/index_test.rb +867 -7
  13. data/lib/ruby_indexer/test/instance_variables_test.rb +131 -0
  14. data/lib/ruby_indexer/test/method_test.rb +57 -0
  15. data/lib/ruby_indexer/test/rbs_indexer_test.rb +42 -0
  16. data/lib/ruby_indexer/test/test_case.rb +10 -1
  17. data/lib/ruby_lsp/addon.rb +8 -8
  18. data/lib/ruby_lsp/document.rb +26 -3
  19. data/lib/ruby_lsp/global_state.rb +37 -16
  20. data/lib/ruby_lsp/internal.rb +2 -0
  21. data/lib/ruby_lsp/listeners/code_lens.rb +2 -2
  22. data/lib/ruby_lsp/listeners/completion.rb +74 -17
  23. data/lib/ruby_lsp/listeners/definition.rb +82 -24
  24. data/lib/ruby_lsp/listeners/hover.rb +62 -6
  25. data/lib/ruby_lsp/listeners/signature_help.rb +4 -4
  26. data/lib/ruby_lsp/node_context.rb +39 -0
  27. data/lib/ruby_lsp/requests/code_action_resolve.rb +73 -2
  28. data/lib/ruby_lsp/requests/code_actions.rb +16 -15
  29. data/lib/ruby_lsp/requests/completion.rb +21 -13
  30. data/lib/ruby_lsp/requests/completion_resolve.rb +9 -0
  31. data/lib/ruby_lsp/requests/definition.rb +25 -5
  32. data/lib/ruby_lsp/requests/document_highlight.rb +2 -2
  33. data/lib/ruby_lsp/requests/hover.rb +5 -6
  34. data/lib/ruby_lsp/requests/on_type_formatting.rb +8 -4
  35. data/lib/ruby_lsp/requests/signature_help.rb +3 -3
  36. data/lib/ruby_lsp/requests/support/common.rb +4 -3
  37. data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +23 -6
  38. data/lib/ruby_lsp/requests/support/rubocop_formatter.rb +5 -1
  39. data/lib/ruby_lsp/requests/support/rubocop_runner.rb +4 -0
  40. data/lib/ruby_lsp/requests/workspace_symbol.rb +7 -4
  41. data/lib/ruby_lsp/server.rb +22 -5
  42. data/lib/ruby_lsp/test_helper.rb +1 -0
  43. metadata +29 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebc166637de670ea02144e74ccb2e99ae1a9824c9f99995380d81bed99ff6a29
4
- data.tar.gz: 48b7ef9364f4d1a8044042c8476414e87da5b38ca4871683c16d06636fc8e411
3
+ metadata.gz: c02fa9ec776002a86f4eeee4037132d8b0f9403f101ccff5c7a31c46385a2818
4
+ data.tar.gz: 3b788794763cee273e2ce677955c3750ebac90962c8d328946f91998a900eca5
5
5
  SHA512:
6
- metadata.gz: 80c4f791e7dfef66623f5190eaba4dc76c745a27f74238d912c34711c408803ec952d5ec3e8041ebb6410b99c74d2f3d8274db5dffa8f187e48a7032a3960086
7
- data.tar.gz: 941209321fb263b9a22cbe27102e8761c6ef127902e2b74f760fec1a8701d96e5bcef5f01c704e7215e061437cac2577c38e100464cccfe03909aa42ee1e318e
6
+ metadata.gz: e3e152e24d1dca4aca721537f64df9062ae48aeea65b361ffd80dc6710cd263b0e8d1181f970b6d06e6147882c1cad40ba91d25ef6f684e2f5374a9738e1fae9
7
+ data.tar.gz: 79c3eb785ac55de19c4e9031ed6c8ca0a9a6df27156244ba7ee3ca2109659f8f2b9ce6efe7259cfcd65922a0b8cefc384fca2215dbdffac41735d9149db651a0
data/README.md CHANGED
@@ -48,9 +48,11 @@ If using VS Code, all you have to do is install the [Ruby LSP
48
48
  extension](https://marketplace.visualstudio.com/items?itemName=Shopify.ruby-lsp) to get the extra features in the
49
49
  editor. Do not install the `ruby-lsp` gem manually.
50
50
 
51
+ For more information on using and configuring the extension, see [vscode/README.md](vscode/README.md).
52
+
51
53
  ### With other editors
52
54
 
53
- See [editors](EDITORS.md) for community instructions on setting up the Ruby LSP.
55
+ See [editors](EDITORS.md) for community instructions on setting up the Ruby LSP, which current includes Emacs, Neovim, Sublime Text, and Zed.
54
56
 
55
57
  The gem can be installed by doing
56
58
  ```shell
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.16.7
1
+ 0.17.3
@@ -11,6 +11,7 @@ module RubyIndexer
11
11
  def initialize(index, dispatcher, parse_result, file_path)
12
12
  @index = index
13
13
  @file_path = file_path
14
+ @visibility_stack = T.let([Entry::Visibility::PUBLIC], T::Array[Entry::Visibility])
14
15
  @comments_by_line = T.let(
15
16
  parse_result.comments.to_h do |c|
16
17
  [c.location.start_line, c]
@@ -35,6 +36,7 @@ module RubyIndexer
35
36
  :on_def_node_enter,
36
37
  :on_def_node_leave,
37
38
  :on_call_node_enter,
39
+ :on_call_node_leave,
38
40
  :on_multi_write_node_enter,
39
41
  :on_constant_path_write_node_enter,
40
42
  :on_constant_path_or_write_node_enter,
@@ -45,11 +47,18 @@ module RubyIndexer
45
47
  :on_constant_or_write_node_enter,
46
48
  :on_constant_and_write_node_enter,
47
49
  :on_constant_operator_write_node_enter,
50
+ :on_instance_variable_write_node_enter,
51
+ :on_instance_variable_and_write_node_enter,
52
+ :on_instance_variable_operator_write_node_enter,
53
+ :on_instance_variable_or_write_node_enter,
54
+ :on_instance_variable_target_node_enter,
55
+ :on_alias_method_node_enter,
48
56
  )
49
57
  end
50
58
 
51
59
  sig { params(node: Prism::ClassNode).void }
52
60
  def on_class_node_enter(node)
61
+ @visibility_stack.push(Entry::Visibility::PUBLIC)
53
62
  name = node.constant_path.location.slice
54
63
 
55
64
  comments = collect_comments(node)
@@ -58,10 +67,14 @@ module RubyIndexer
58
67
  parent_class = case superclass
59
68
  when Prism::ConstantReadNode, Prism::ConstantPathNode
60
69
  superclass.slice
70
+ else
71
+ "::Object"
61
72
  end
62
73
 
74
+ nesting = name.start_with?("::") ? [name.delete_prefix("::")] : @stack + [name.delete_prefix("::")]
75
+
63
76
  entry = Entry::Class.new(
64
- fully_qualify_name(name),
77
+ nesting,
65
78
  @file_path,
66
79
  node.location,
67
80
  comments,
@@ -77,14 +90,18 @@ module RubyIndexer
77
90
  def on_class_node_leave(node)
78
91
  @stack.pop
79
92
  @owner_stack.pop
93
+ @visibility_stack.pop
80
94
  end
81
95
 
82
96
  sig { params(node: Prism::ModuleNode).void }
83
97
  def on_module_node_enter(node)
98
+ @visibility_stack.push(Entry::Visibility::PUBLIC)
84
99
  name = node.constant_path.location.slice
85
100
 
86
101
  comments = collect_comments(node)
87
- entry = Entry::Module.new(fully_qualify_name(name), @file_path, node.location, comments)
102
+
103
+ nesting = name.start_with?("::") ? [name.delete_prefix("::")] : @stack + [name.delete_prefix("::")]
104
+ entry = Entry::Module.new(nesting, @file_path, node.location, comments)
88
105
 
89
106
  @owner_stack << entry
90
107
  @index << entry
@@ -95,6 +112,7 @@ module RubyIndexer
95
112
  def on_module_node_leave(node)
96
113
  @stack.pop
97
114
  @owner_stack.pop
115
+ @visibility_stack.pop
98
116
  end
99
117
 
100
118
  sig { params(node: Prism::MultiWriteNode).void }
@@ -194,10 +212,29 @@ module RubyIndexer
194
212
  handle_attribute(node, reader: false, writer: true)
195
213
  when :attr_accessor
196
214
  handle_attribute(node, reader: true, writer: true)
197
- when :include
198
- handle_module_operation(node, :included_modules)
199
- when :prepend
200
- handle_module_operation(node, :prepended_modules)
215
+ when :alias_method
216
+ handle_alias_method(node)
217
+ when :include, :prepend, :extend
218
+ handle_module_operation(node, message)
219
+ when :public
220
+ @visibility_stack.push(Entry::Visibility::PUBLIC)
221
+ when :protected
222
+ @visibility_stack.push(Entry::Visibility::PROTECTED)
223
+ when :private
224
+ @visibility_stack.push(Entry::Visibility::PRIVATE)
225
+ end
226
+ end
227
+
228
+ sig { params(node: Prism::CallNode).void }
229
+ def on_call_node_leave(node)
230
+ message = node.name
231
+ case message
232
+ when :public, :protected, :private
233
+ # We want to restore the visibility stack when we leave a method definition with a visibility modifier
234
+ # e.g. `private def foo; end`
235
+ if node.arguments&.arguments&.first&.is_a?(Prism::DefNode)
236
+ @visibility_stack.pop
237
+ end
201
238
  end
202
239
  end
203
240
 
@@ -206,6 +243,7 @@ module RubyIndexer
206
243
  @inside_def = true
207
244
  method_name = node.name.to_s
208
245
  comments = collect_comments(node)
246
+
209
247
  case node.receiver
210
248
  when nil
211
249
  @index << Entry::InstanceMethod.new(
@@ -214,6 +252,7 @@ module RubyIndexer
214
252
  node.location,
215
253
  comments,
216
254
  node.parameters,
255
+ current_visibility,
217
256
  @owner_stack.last,
218
257
  )
219
258
  when Prism::SelfNode
@@ -223,6 +262,7 @@ module RubyIndexer
223
262
  node.location,
224
263
  comments,
225
264
  node.parameters,
265
+ current_visibility,
226
266
  @owner_stack.last,
227
267
  )
228
268
  end
@@ -233,6 +273,90 @@ module RubyIndexer
233
273
  @inside_def = false
234
274
  end
235
275
 
276
+ sig { params(node: Prism::InstanceVariableWriteNode).void }
277
+ def on_instance_variable_write_node_enter(node)
278
+ name = node.name.to_s
279
+ return if name == "@"
280
+
281
+ @index << Entry::InstanceVariable.new(
282
+ name,
283
+ @file_path,
284
+ node.name_loc,
285
+ collect_comments(node),
286
+ @owner_stack.last,
287
+ )
288
+ end
289
+
290
+ sig { params(node: Prism::InstanceVariableAndWriteNode).void }
291
+ def on_instance_variable_and_write_node_enter(node)
292
+ name = node.name.to_s
293
+ return if name == "@"
294
+
295
+ @index << Entry::InstanceVariable.new(
296
+ name,
297
+ @file_path,
298
+ node.name_loc,
299
+ collect_comments(node),
300
+ @owner_stack.last,
301
+ )
302
+ end
303
+
304
+ sig { params(node: Prism::InstanceVariableOperatorWriteNode).void }
305
+ def on_instance_variable_operator_write_node_enter(node)
306
+ name = node.name.to_s
307
+ return if name == "@"
308
+
309
+ @index << Entry::InstanceVariable.new(
310
+ name,
311
+ @file_path,
312
+ node.name_loc,
313
+ collect_comments(node),
314
+ @owner_stack.last,
315
+ )
316
+ end
317
+
318
+ sig { params(node: Prism::InstanceVariableOrWriteNode).void }
319
+ def on_instance_variable_or_write_node_enter(node)
320
+ name = node.name.to_s
321
+ return if name == "@"
322
+
323
+ @index << Entry::InstanceVariable.new(
324
+ name,
325
+ @file_path,
326
+ node.name_loc,
327
+ collect_comments(node),
328
+ @owner_stack.last,
329
+ )
330
+ end
331
+
332
+ sig { params(node: Prism::InstanceVariableTargetNode).void }
333
+ def on_instance_variable_target_node_enter(node)
334
+ name = node.name.to_s
335
+ return if name == "@"
336
+
337
+ @index << Entry::InstanceVariable.new(
338
+ name,
339
+ @file_path,
340
+ node.location,
341
+ collect_comments(node),
342
+ @owner_stack.last,
343
+ )
344
+ end
345
+
346
+ sig { params(node: Prism::AliasMethodNode).void }
347
+ def on_alias_method_node_enter(node)
348
+ method_name = node.new_name.slice
349
+ comments = collect_comments(node)
350
+ @index << Entry::UnresolvedMethodAlias.new(
351
+ method_name,
352
+ node.old_name.slice,
353
+ @owner_stack.last,
354
+ @file_path,
355
+ node.new_name.location,
356
+ comments,
357
+ )
358
+ end
359
+
236
360
  private
237
361
 
238
362
  sig { params(node: Prism::CallNode).void }
@@ -257,7 +381,44 @@ module RubyIndexer
257
381
  # The private_constant method does not resolve the constant name. It always points to a constant that needs to
258
382
  # exist in the current namespace
259
383
  entries = @index[fully_qualify_name(name)]
260
- entries&.each { |entry| entry.visibility = :private }
384
+ entries&.each { |entry| entry.visibility = Entry::Visibility::PRIVATE }
385
+ end
386
+
387
+ sig { params(node: Prism::CallNode).void }
388
+ def handle_alias_method(node)
389
+ arguments = node.arguments&.arguments
390
+ return unless arguments
391
+
392
+ new_name, old_name = arguments
393
+ return unless new_name && old_name
394
+
395
+ new_name_value = case new_name
396
+ when Prism::StringNode
397
+ new_name.content
398
+ when Prism::SymbolNode
399
+ new_name.value
400
+ end
401
+
402
+ return unless new_name_value
403
+
404
+ old_name_value = case old_name
405
+ when Prism::StringNode
406
+ old_name.content
407
+ when Prism::SymbolNode
408
+ old_name.value
409
+ end
410
+
411
+ return unless old_name_value
412
+
413
+ comments = collect_comments(node)
414
+ @index << Entry::UnresolvedMethodAlias.new(
415
+ new_name_value,
416
+ old_name_value,
417
+ @owner_stack.last,
418
+ @file_path,
419
+ new_name.location,
420
+ comments,
421
+ )
261
422
  end
262
423
 
263
424
  sig do
@@ -354,8 +515,15 @@ module RubyIndexer
354
515
 
355
516
  next unless name && loc
356
517
 
357
- @index << Entry::Accessor.new(name, @file_path, loc, comments, @owner_stack.last) if reader
358
- @index << Entry::Accessor.new("#{name}=", @file_path, loc, comments, @owner_stack.last) if writer
518
+ @index << Entry::Accessor.new(name, @file_path, loc, comments, current_visibility, @owner_stack.last) if reader
519
+ @index << Entry::Accessor.new(
520
+ "#{name}=",
521
+ @file_path,
522
+ loc,
523
+ comments,
524
+ current_visibility,
525
+ @owner_stack.last,
526
+ ) if writer
359
527
  end
360
528
  end
361
529
 
@@ -369,17 +537,26 @@ module RubyIndexer
369
537
  arguments = node.arguments&.arguments
370
538
  return unless arguments
371
539
 
372
- names = arguments.filter_map do |node|
373
- if node.is_a?(Prism::ConstantReadNode) || node.is_a?(Prism::ConstantPathNode)
374
- node.full_name
540
+ arguments.each do |node|
541
+ next unless node.is_a?(Prism::ConstantReadNode) || node.is_a?(Prism::ConstantPathNode)
542
+
543
+ case operation
544
+ when :include
545
+ owner.mixin_operations << Entry::Include.new(node.full_name)
546
+ when :prepend
547
+ owner.mixin_operations << Entry::Prepend.new(node.full_name)
548
+ when :extend
549
+ owner.mixin_operations << Entry::Extend.new(node.full_name)
375
550
  end
376
- rescue Prism::ConstantPathNode::DynamicPartsInConstantPathError
377
- # TO DO: add MissingNodesInConstantPathError when released in Prism
378
- # If a constant path reference is dynamic or missing parts, we can't
379
- # index it
551
+ rescue Prism::ConstantPathNode::DynamicPartsInConstantPathError,
552
+ Prism::ConstantPathNode::MissingNodesInConstantPathError
553
+ # Do nothing
380
554
  end
381
- collection = operation == :included_modules ? owner.included_modules : owner.prepended_modules
382
- collection.concat(names)
555
+ end
556
+
557
+ sig { returns(Entry::Visibility) }
558
+ def current_visibility
559
+ T.must(@visibility_stack.last)
383
560
  end
384
561
  end
385
562
  end
@@ -3,6 +3,14 @@
3
3
 
4
4
  module RubyIndexer
5
5
  class Entry
6
+ class Visibility < T::Enum
7
+ enums do
8
+ PUBLIC = new(:public)
9
+ PROTECTED = new(:protected)
10
+ PRIVATE = new(:private)
11
+ end
12
+ end
13
+
6
14
  extend T::Sig
7
15
 
8
16
  sig { returns(String) }
@@ -17,7 +25,7 @@ module RubyIndexer
17
25
  sig { returns(T::Array[String]) }
18
26
  attr_reader :comments
19
27
 
20
- sig { returns(Symbol) }
28
+ sig { returns(Visibility) }
21
29
  attr_accessor :visibility
22
30
 
23
31
  sig do
@@ -32,7 +40,7 @@ module RubyIndexer
32
40
  @name = name
33
41
  @file_path = file_path
34
42
  @comments = comments
35
- @visibility = T.let(:public, Symbol)
43
+ @visibility = T.let(Visibility::PUBLIC, Visibility)
36
44
 
37
45
  @location = T.let(
38
46
  if location.is_a?(Prism::Location)
@@ -49,11 +57,35 @@ module RubyIndexer
49
57
  )
50
58
  end
51
59
 
60
+ sig { returns(T::Boolean) }
61
+ def private?
62
+ visibility == Visibility::PRIVATE
63
+ end
64
+
52
65
  sig { returns(String) }
53
66
  def file_name
54
67
  File.basename(@file_path)
55
68
  end
56
69
 
70
+ class ModuleOperation
71
+ extend T::Sig
72
+ extend T::Helpers
73
+
74
+ abstract!
75
+
76
+ sig { returns(String) }
77
+ attr_reader :module_name
78
+
79
+ sig { params(module_name: String).void }
80
+ def initialize(module_name)
81
+ @module_name = module_name
82
+ end
83
+ end
84
+
85
+ class Include < ModuleOperation; end
86
+ class Prepend < ModuleOperation; end
87
+ class Extend < ModuleOperation; end
88
+
57
89
  class Namespace < Entry
58
90
  extend T::Sig
59
91
  extend T::Helpers
@@ -61,13 +93,40 @@ module RubyIndexer
61
93
  abstract!
62
94
 
63
95
  sig { returns(T::Array[String]) }
64
- def included_modules
65
- @included_modules ||= T.let([], T.nilable(T::Array[String]))
96
+ attr_reader :nesting
97
+
98
+ sig do
99
+ params(
100
+ nesting: T::Array[String],
101
+ file_path: String,
102
+ location: T.any(Prism::Location, RubyIndexer::Location),
103
+ comments: T::Array[String],
104
+ ).void
105
+ end
106
+ def initialize(nesting, file_path, location, comments)
107
+ @name = T.let(nesting.join("::"), String)
108
+ # The original nesting where this namespace was discovered
109
+ @nesting = nesting
110
+
111
+ super(@name, file_path, location, comments)
66
112
  end
67
113
 
68
114
  sig { returns(T::Array[String]) }
69
- def prepended_modules
70
- @prepended_modules ||= T.let([], T.nilable(T::Array[String]))
115
+ def mixin_operation_module_names
116
+ mixin_operations.map(&:module_name)
117
+ end
118
+
119
+ # Stores all explicit prepend, include and extend operations in the exact order they were discovered in the source
120
+ # code. Maintaining the order is essential to linearize ancestors the right way when a module is both included
121
+ # and prepended
122
+ sig { returns(T::Array[ModuleOperation]) }
123
+ def mixin_operations
124
+ @mixin_operations ||= T.let([], T.nilable(T::Array[ModuleOperation]))
125
+ end
126
+
127
+ sig { returns(Integer) }
128
+ def ancestor_hash
129
+ mixin_operation_module_names.hash
71
130
  end
72
131
  end
73
132
 
@@ -84,17 +143,23 @@ module RubyIndexer
84
143
 
85
144
  sig do
86
145
  params(
87
- name: String,
146
+ nesting: T::Array[String],
88
147
  file_path: String,
89
148
  location: T.any(Prism::Location, RubyIndexer::Location),
90
149
  comments: T::Array[String],
91
150
  parent_class: T.nilable(String),
92
151
  ).void
93
152
  end
94
- def initialize(name, file_path, location, comments, parent_class)
95
- super(name, file_path, location, comments)
153
+ def initialize(nesting, file_path, location, comments, parent_class)
154
+ super(nesting, file_path, location, comments)
155
+
96
156
  @parent_class = T.let(parent_class, T.nilable(String))
97
157
  end
158
+
159
+ sig { override.returns(Integer) }
160
+ def ancestor_hash
161
+ [mixin_operation_module_names, @parent_class].hash
162
+ end
98
163
  end
99
164
 
100
165
  class Constant < Entry
@@ -188,11 +253,13 @@ module RubyIndexer
188
253
  file_path: String,
189
254
  location: T.any(Prism::Location, RubyIndexer::Location),
190
255
  comments: T::Array[String],
256
+ visibility: Visibility,
191
257
  owner: T.nilable(Entry::Namespace),
192
258
  ).void
193
259
  end
194
- def initialize(name, file_path, location, comments, owner)
260
+ def initialize(name, file_path, location, comments, visibility, owner) # rubocop:disable Metrics/ParameterLists
195
261
  super(name, file_path, location, comments)
262
+ @visibility = visibility
196
263
  @owner = owner
197
264
  end
198
265
 
@@ -227,11 +294,12 @@ module RubyIndexer
227
294
  location: T.any(Prism::Location, RubyIndexer::Location),
228
295
  comments: T::Array[String],
229
296
  parameters_node: T.nilable(Prism::ParametersNode),
297
+ visibility: Visibility,
230
298
  owner: T.nilable(Entry::Namespace),
231
299
  ).void
232
300
  end
233
- def initialize(name, file_path, location, comments, parameters_node, owner) # rubocop:disable Metrics/ParameterLists
234
- super(name, file_path, location, comments, owner)
301
+ def initialize(name, file_path, location, comments, parameters_node, visibility, owner) # rubocop:disable Metrics/ParameterLists
302
+ super(name, file_path, location, comments, visibility, owner)
235
303
 
236
304
  @parameters = T.let(list_params(parameters_node), T::Array[Parameter])
237
305
  end
@@ -377,8 +445,57 @@ module RubyIndexer
377
445
  def initialize(target, unresolved_alias)
378
446
  super(unresolved_alias.name, unresolved_alias.file_path, unresolved_alias.location, unresolved_alias.comments)
379
447
 
448
+ @visibility = unresolved_alias.visibility
380
449
  @target = target
381
450
  end
382
451
  end
452
+
453
+ # Represents an instance variable e.g.: @a = 1
454
+ class InstanceVariable < Entry
455
+ sig { returns(T.nilable(Entry::Namespace)) }
456
+ attr_reader :owner
457
+
458
+ sig do
459
+ params(
460
+ name: String,
461
+ file_path: String,
462
+ location: T.any(Prism::Location, RubyIndexer::Location),
463
+ comments: T::Array[String],
464
+ owner: T.nilable(Entry::Namespace),
465
+ ).void
466
+ end
467
+ def initialize(name, file_path, location, comments, owner)
468
+ super(name, file_path, location, comments)
469
+ @owner = owner
470
+ end
471
+ end
472
+
473
+ class UnresolvedMethodAlias < Entry
474
+ extend T::Sig
475
+
476
+ sig { returns(String) }
477
+ attr_reader :new_name, :old_name
478
+
479
+ sig { returns(T.nilable(Entry::Namespace)) }
480
+ attr_reader :owner
481
+
482
+ sig do
483
+ params(
484
+ new_name: String,
485
+ old_name: String,
486
+ owner: T.nilable(Entry::Namespace),
487
+ file_path: String,
488
+ location: Prism::Location,
489
+ comments: T::Array[String],
490
+ ).void
491
+ end
492
+ def initialize(new_name, old_name, owner, file_path, location, comments) # rubocop:disable Metrics/ParameterLists
493
+ super(new_name, file_path, location, comments)
494
+
495
+ @new_name = new_name
496
+ @old_name = old_name
497
+ @owner = owner
498
+ end
499
+ end
383
500
  end
384
501
  end