Class: RubyLsp::Operandi::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_lsp/operandi/definition.rb

Constant Summary collapse

CONDITION_OPTIONS =

Condition options that reference methods

[:if, :unless].freeze

Instance Method Summary collapse

Constructor Details

#initialize(response_builder, uri, node_context, index, dispatcher) ⇒ Definition

Returns a new instance of Definition.



9
10
11
12
13
14
15
16
17
# File 'lib/ruby_lsp/operandi/definition.rb', line 9

def initialize(response_builder, uri, node_context, index, dispatcher)
  @response_builder = response_builder
  @uri = uri
  @node_context = node_context
  @index = index

  # Register for symbol nodes - this is what gets triggered when user clicks on :method_name
  dispatcher.register(self, :on_symbol_node_enter)
end

Instance Method Details

#on_symbol_node_enter(node) ⇒ Object

Called when cursor is on a symbol node (e.g., :validate in step :validate)



20
21
22
23
24
25
26
27
28
29
# File 'lib/ruby_lsp/operandi/definition.rb', line 20

def on_symbol_node_enter(node)
  # Check if this symbol is part of a step call by examining the call context
  call_node = find_parent_step_call
  return unless call_node

  method_name = determine_method_name(node, call_node)
  return unless method_name

  find_and_append_method_location(method_name)
end