Class: RubyLsp::Listeners::DocumentHighlight

Inherits:
RubyLsp::Listener show all
Extended by:
T::Sig
Defined in:
lib/ruby_lsp/listeners/document_highlight.rb

Constant Summary collapse

ResponseType =
type_member { { fixed: T::Array[Interface::DocumentHighlight] } }
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 Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RubyLsp::Listener

#response

Methods included from Requests::Support::Common

#create_code_lens, #markdown_from_index_entries, #not_in_dependencies?, #range_from_location, #range_from_node, #self_receiver?, #visible?

Constructor Details

#initialize(target, parent, dispatcher) ⇒ DocumentHighlight

Returns a new instance of DocumentHighlight.



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
178
179
180
181
182
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 100

def initialize(target, parent, dispatcher)
  super(dispatcher)

  @_response = T.let([], T::Array[Interface::DocumentHighlight])

  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 Attribute Details

#_responseObject (readonly)

Returns the value of attribute _response.



91
92
93
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 91

def _response
  @_response
end

Instance Method Details

#on_block_parameter_node_enter(node) ⇒ Object



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

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



185
186
187
188
189
# File 'lib/ruby_lsp/listeners/document_highlight.rb', line 185

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

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

#on_class_node_enter(node) ⇒ Object



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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

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

#on_constant_path_operator_write_node_enter(node) ⇒ Object



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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