Class: RubyLsp::Listeners::DocumentHighlight

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Requests::Support::Common
Defined in:
lib/ruby_lsp/listeners/document_highlight.rb

Constant Summary collapse

GLOBAL_VARIABLE_NODES =
T.let(
  [
    Prism::GlobalVariableAndWriteNode,
    Prism::GlobalVariableOperatorWriteNode,
    Prism::GlobalVariableOrWriteNode,
    Prism::GlobalVariableReadNode,
    Prism::GlobalVariableTargetNode,
    Prism::GlobalVariableWriteNode,
  ],
  T::Array[T.class_of(Prism::Node)],
)
INSTANCE_VARIABLE_NODES =
T.let(
  [
    Prism::InstanceVariableAndWriteNode,
    Prism::InstanceVariableOperatorWriteNode,
    Prism::InstanceVariableOrWriteNode,
    Prism::InstanceVariableReadNode,
    Prism::InstanceVariableTargetNode,
    Prism::InstanceVariableWriteNode,
  ],
  T::Array[T.class_of(Prism::Node)],
)
CONSTANT_NODES =
T.let(
  [
    Prism::ConstantAndWriteNode,
    Prism::ConstantOperatorWriteNode,
    Prism::ConstantOrWriteNode,
    Prism::ConstantReadNode,
    Prism::ConstantTargetNode,
    Prism::ConstantWriteNode,
  ],
  T::Array[T.class_of(Prism::Node)],
)
CONSTANT_PATH_NODES =
T.let(
  [
    Prism::ConstantPathAndWriteNode,
    Prism::ConstantPathNode,
    Prism::ConstantPathOperatorWriteNode,
    Prism::ConstantPathOrWriteNode,
    Prism::ConstantPathTargetNode,
    Prism::ConstantPathWriteNode,
  ],
  T::Array[T.class_of(Prism::Node)],
)
CLASS_VARIABLE_NODES =
T.let(
  [
    Prism::ClassVariableAndWriteNode,
    Prism::ClassVariableOperatorWriteNode,
    Prism::ClassVariableOrWriteNode,
    Prism::ClassVariableReadNode,
    Prism::ClassVariableTargetNode,
    Prism::ClassVariableWriteNode,
  ],
  T::Array[T.class_of(Prism::Node)],
)
LOCAL_NODES =
T.let(
  [
    Prism::LocalVariableAndWriteNode,
    Prism::LocalVariableOperatorWriteNode,
    Prism::LocalVariableOrWriteNode,
    Prism::LocalVariableReadNode,
    Prism::LocalVariableTargetNode,
    Prism::LocalVariableWriteNode,
    Prism::BlockParameterNode,
    Prism::RequiredParameterNode,
    Prism::RequiredKeywordParameterNode,
    Prism::OptionalKeywordParameterNode,
    Prism::RestParameterNode,
    Prism::OptionalParameterNode,
    Prism::KeywordRestParameterNode,
  ],
  T::Array[T.class_of(Prism::Node)],
)

Instance Method Summary collapse

Methods included from Requests::Support::Common

#categorized_markdown_from_index_entries, #constant_name, #create_code_lens, #each_constant_path_part, #kind_for_entry, #markdown_from_index_entries, #namespace_constant_name, #not_in_dependencies?, #range_from_location, #range_from_node, #self_receiver?, #sorbet_level_true_or_higher?, #visible?

Constructor Details

#initialize(response_builder, target, parent, dispatcher) ⇒ DocumentHighlight

Returns a new instance of DocumentHighlight.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 97

def initialize(response_builder, target, parent, dispatcher)
  @response_builder = response_builder

  return unless target && parent

  highlight_target =
    case target
    when Prism::GlobalVariableReadNode, Prism::GlobalVariableAndWriteNode, Prism::GlobalVariableOperatorWriteNode,
      Prism::GlobalVariableOrWriteNode, Prism::GlobalVariableTargetNode, Prism::GlobalVariableWriteNode,
      Prism::InstanceVariableAndWriteNode, Prism::InstanceVariableOperatorWriteNode,
      Prism::InstanceVariableOrWriteNode, Prism::InstanceVariableReadNode, Prism::InstanceVariableTargetNode,
      Prism::InstanceVariableWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOperatorWriteNode,
      Prism::ConstantOrWriteNode, Prism::ConstantPathAndWriteNode, Prism::ConstantPathNode,
      Prism::ConstantPathOperatorWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathTargetNode,
      Prism::ConstantPathWriteNode, Prism::ConstantReadNode, Prism::ConstantTargetNode, Prism::ConstantWriteNode,
      Prism::ClassVariableAndWriteNode, Prism::ClassVariableOperatorWriteNode, Prism::ClassVariableOrWriteNode,
      Prism::ClassVariableReadNode, Prism::ClassVariableTargetNode, Prism::ClassVariableWriteNode,
      Prism::LocalVariableAndWriteNode, Prism::LocalVariableOperatorWriteNode, Prism::LocalVariableOrWriteNode,
      Prism::LocalVariableReadNode, Prism::LocalVariableTargetNode, Prism::LocalVariableWriteNode,
      Prism::CallNode, Prism::BlockParameterNode, Prism::RequiredKeywordParameterNode,
      Prism::RequiredKeywordParameterNode, Prism::KeywordRestParameterNode, Prism::OptionalParameterNode,
      Prism::RequiredParameterNode, Prism::RestParameterNode
      target
    end

  @target = T.let(highlight_target, T.nilable(Prism::Node))
  @target_value = T.let(node_value(highlight_target), T.nilable(String))

  if @target && @target_value
    dispatcher.register(
      self,
      :on_call_node_enter,
      :on_def_node_enter,
      :on_global_variable_target_node_enter,
      :on_instance_variable_target_node_enter,
      :on_constant_path_target_node_enter,
      :on_constant_target_node_enter,
      :on_class_variable_target_node_enter,
      :on_local_variable_target_node_enter,
      :on_block_parameter_node_enter,
      :on_required_parameter_node_enter,
      :on_class_node_enter,
      :on_module_node_enter,
      :on_local_variable_read_node_enter,
      :on_constant_path_node_enter,
      :on_constant_read_node_enter,
      :on_instance_variable_read_node_enter,
      :on_class_variable_read_node_enter,
      :on_global_variable_read_node_enter,
      :on_constant_path_write_node_enter,
      :on_constant_path_or_write_node_enter,
      :on_constant_path_and_write_node_enter,
      :on_constant_path_operator_write_node_enter,
      :on_local_variable_write_node_enter,
      :on_required_keyword_parameter_node_enter,
      :on_optional_keyword_parameter_node_enter,
      :on_rest_parameter_node_enter,
      :on_optional_parameter_node_enter,
      :on_keyword_rest_parameter_node_enter,
      :on_local_variable_and_write_node_enter,
      :on_local_variable_operator_write_node_enter,
      :on_local_variable_or_write_node_enter,
      :on_class_variable_write_node_enter,
      :on_class_variable_or_write_node_enter,
      :on_class_variable_operator_write_node_enter,
      :on_class_variable_and_write_node_enter,
      :on_constant_write_node_enter,
      :on_constant_or_write_node_enter,
      :on_constant_operator_write_node_enter,
      :on_instance_variable_write_node_enter,
      :on_constant_and_write_node_enter,
      :on_instance_variable_or_write_node_enter,
      :on_instance_variable_and_write_node_enter,
      :on_instance_variable_operator_write_node_enter,
      :on_global_variable_write_node_enter,
      :on_global_variable_or_write_node_enter,
      :on_global_variable_and_write_node_enter,
      :on_global_variable_operator_write_node_enter,
    )
  end
end

Instance Method Details

#on_block_parameter_node_enter(node) ⇒ Object



240
241
242
243
244
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 240

def on_block_parameter_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.location)
end

#on_call_node_enter(node) ⇒ Object



180
181
182
183
184
185
186
187
188
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 180

def on_call_node_enter(node)
  return unless matches?(node, [Prism::CallNode, Prism::DefNode])

  loc = node.message_loc
  # if we have `foo.` it's a call node but there is no message yet.
  return unless loc

  add_highlight(Constant::DocumentHighlightKind::READ, loc)
end

#on_class_node_enter(node) ⇒ Object



254
255
256
257
258
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 254

def on_class_node_enter(node)
  return unless matches?(node, CONSTANT_NODES + CONSTANT_PATH_NODES + [Prism::ClassNode])

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.constant_path.location)
end

#on_class_variable_and_write_node_enter(node) ⇒ Object



424
425
426
427
428
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 424

def on_class_variable_and_write_node_enter(node)
  return unless matches?(node, CLASS_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_class_variable_operator_write_node_enter(node) ⇒ Object



417
418
419
420
421
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 417

def on_class_variable_operator_write_node_enter(node)
  return unless matches?(node, CLASS_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_class_variable_or_write_node_enter(node) ⇒ Object



410
411
412
413
414
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 410

def on_class_variable_or_write_node_enter(node)
  return unless matches?(node, CLASS_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_class_variable_read_node_enter(node) ⇒ Object



296
297
298
299
300
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 296

def on_class_variable_read_node_enter(node)
  return unless matches?(node, CLASS_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::READ, node.location)
end

#on_class_variable_target_node_enter(node) ⇒ Object



226
227
228
229
230
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 226

def on_class_variable_target_node_enter(node)
  return unless matches?(node, CLASS_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.location)
end

#on_class_variable_write_node_enter(node) ⇒ Object



403
404
405
406
407
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 403

def on_class_variable_write_node_enter(node)
  return unless matches?(node, CLASS_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_constant_and_write_node_enter(node) ⇒ Object



480
481
482
483
484
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 480

def on_constant_and_write_node_enter(node)
  return unless matches?(node, CONSTANT_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_constant_operator_write_node_enter(node) ⇒ Object



445
446
447
448
449
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 445

def on_constant_operator_write_node_enter(node)
  return unless matches?(node, CONSTANT_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_constant_or_write_node_enter(node) ⇒ Object



438
439
440
441
442
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 438

def on_constant_or_write_node_enter(node)
  return unless matches?(node, CONSTANT_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_constant_path_and_write_node_enter(node) ⇒ Object



324
325
326
327
328
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 324

def on_constant_path_and_write_node_enter(node)
  return unless matches?(node, CONSTANT_PATH_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.target.location)
end

#on_constant_path_node_enter(node) ⇒ Object



275
276
277
278
279
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 275

def on_constant_path_node_enter(node)
  return unless matches?(node, CONSTANT_PATH_NODES)

  add_highlight(Constant::DocumentHighlightKind::READ, node.name_loc)
end

#on_constant_path_operator_write_node_enter(node) ⇒ Object



331
332
333
334
335
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 331

def on_constant_path_operator_write_node_enter(node)
  return unless matches?(node, CONSTANT_PATH_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.target.location)
end

#on_constant_path_or_write_node_enter(node) ⇒ Object



317
318
319
320
321
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 317

def on_constant_path_or_write_node_enter(node)
  return unless matches?(node, CONSTANT_PATH_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.target.location)
end

#on_constant_path_target_node_enter(node) ⇒ Object



212
213
214
215
216
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 212

def on_constant_path_target_node_enter(node)
  return unless matches?(node, CONSTANT_PATH_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.location)
end

#on_constant_path_write_node_enter(node) ⇒ Object



310
311
312
313
314
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 310

def on_constant_path_write_node_enter(node)
  return unless matches?(node, CONSTANT_PATH_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.target.location)
end

#on_constant_read_node_enter(node) ⇒ Object



282
283
284
285
286
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 282

def on_constant_read_node_enter(node)
  return unless matches?(node, CONSTANT_NODES)

  add_highlight(Constant::DocumentHighlightKind::READ, node.location)
end

#on_constant_target_node_enter(node) ⇒ Object



219
220
221
222
223
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 219

def on_constant_target_node_enter(node)
  return unless matches?(node, CONSTANT_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.location)
end

#on_constant_write_node_enter(node) ⇒ Object



431
432
433
434
435
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 431

def on_constant_write_node_enter(node)
  return unless matches?(node, CONSTANT_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_def_node_enter(node) ⇒ Object



191
192
193
194
195
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 191

def on_def_node_enter(node)
  return unless matches?(node, [Prism::CallNode, Prism::DefNode])

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_global_variable_and_write_node_enter(node) ⇒ Object



501
502
503
504
505
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 501

def on_global_variable_and_write_node_enter(node)
  return unless matches?(node, GLOBAL_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_global_variable_operator_write_node_enter(node) ⇒ Object



508
509
510
511
512
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 508

def on_global_variable_operator_write_node_enter(node)
  return unless matches?(node, GLOBAL_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_global_variable_or_write_node_enter(node) ⇒ Object



494
495
496
497
498
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 494

def on_global_variable_or_write_node_enter(node)
  return unless matches?(node, GLOBAL_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_global_variable_read_node_enter(node) ⇒ Object



303
304
305
306
307
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 303

def on_global_variable_read_node_enter(node)
  return unless matches?(node, GLOBAL_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::READ, node.location)
end

#on_global_variable_target_node_enter(node) ⇒ Object



198
199
200
201
202
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 198

def on_global_variable_target_node_enter(node)
  return unless matches?(node, GLOBAL_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.location)
end

#on_global_variable_write_node_enter(node) ⇒ Object



487
488
489
490
491
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 487

def on_global_variable_write_node_enter(node)
  return unless matches?(node, GLOBAL_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_instance_variable_and_write_node_enter(node) ⇒ Object



466
467
468
469
470
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 466

def on_instance_variable_and_write_node_enter(node)
  return unless matches?(node, INSTANCE_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_instance_variable_operator_write_node_enter(node) ⇒ Object



473
474
475
476
477
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 473

def on_instance_variable_operator_write_node_enter(node)
  return unless matches?(node, INSTANCE_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_instance_variable_or_write_node_enter(node) ⇒ Object



459
460
461
462
463
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 459

def on_instance_variable_or_write_node_enter(node)
  return unless matches?(node, INSTANCE_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_instance_variable_read_node_enter(node) ⇒ Object



289
290
291
292
293
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 289

def on_instance_variable_read_node_enter(node)
  return unless matches?(node, INSTANCE_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::READ, node.location)
end

#on_instance_variable_target_node_enter(node) ⇒ Object



205
206
207
208
209
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 205

def on_instance_variable_target_node_enter(node)
  return unless matches?(node, INSTANCE_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.location)
end

#on_instance_variable_write_node_enter(node) ⇒ Object



452
453
454
455
456
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 452

def on_instance_variable_write_node_enter(node)
  return unless matches?(node, INSTANCE_VARIABLE_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_keyword_rest_parameter_node_enter(node) ⇒ Object



374
375
376
377
378
379
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 374

def on_keyword_rest_parameter_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  name_loc = node.name_loc
  add_highlight(Constant::DocumentHighlightKind::WRITE, name_loc) if name_loc
end

#on_local_variable_and_write_node_enter(node) ⇒ Object



382
383
384
385
386
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 382

def on_local_variable_and_write_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_local_variable_operator_write_node_enter(node) ⇒ Object



389
390
391
392
393
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 389

def on_local_variable_operator_write_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_local_variable_or_write_node_enter(node) ⇒ Object



396
397
398
399
400
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 396

def on_local_variable_or_write_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_local_variable_read_node_enter(node) ⇒ Object



268
269
270
271
272
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 268

def on_local_variable_read_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::READ, node.location)
end

#on_local_variable_target_node_enter(node) ⇒ Object



233
234
235
236
237
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 233

def on_local_variable_target_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.location)
end

#on_local_variable_write_node_enter(node) ⇒ Object



338
339
340
341
342
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 338

def on_local_variable_write_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_module_node_enter(node) ⇒ Object



261
262
263
264
265
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 261

def on_module_node_enter(node)
  return unless matches?(node, CONSTANT_NODES + CONSTANT_PATH_NODES + [Prism::ModuleNode])

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.constant_path.location)
end

#on_optional_keyword_parameter_node_enter(node) ⇒ Object



352
353
354
355
356
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 352

def on_optional_keyword_parameter_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_optional_parameter_node_enter(node) ⇒ Object



367
368
369
370
371
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 367

def on_optional_parameter_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_required_keyword_parameter_node_enter(node) ⇒ Object



345
346
347
348
349
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 345

def on_required_keyword_parameter_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc)
end

#on_required_parameter_node_enter(node) ⇒ Object



247
248
249
250
251
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 247

def on_required_parameter_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  add_highlight(Constant::DocumentHighlightKind::WRITE, node.location)
end

#on_rest_parameter_node_enter(node) ⇒ Object



359
360
361
362
363
364
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 359

def on_rest_parameter_node_enter(node)
  return unless matches?(node, LOCAL_NODES)

  name_loc = node.name_loc
  add_highlight(Constant::DocumentHighlightKind::WRITE, name_loc) if name_loc
end