Class: RubyLsp::Operandi::IndexingEnhancement

Inherits:
RubyIndexer::Enhancement
  • Object
show all
Defined in:
lib/ruby_lsp/operandi/indexing_enhancement.rb

Constant Summary collapse

FIELD_DSL_METHODS =

DSL methods that generate getter, predicate, and setter methods

[:arg, :output].freeze

Instance Method Summary collapse

Instance Method Details

#on_call_node_enter(node) ⇒ Object

Called when the indexer encounters a method call node Detects arg and output DSL calls and registers the generated methods



15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby_lsp/operandi/indexing_enhancement.rb', line 15

def on_call_node_enter(node)
  return unless @listener.current_owner
  return unless FIELD_DSL_METHODS.include?(node.name)

  field_name = extract_field_name(node)
  return unless field_name

  ruby_type = extract_ruby_type(node)
  register_field_methods(field_name, node.location, ruby_type)
end

#on_call_node_leave(node) ⇒ Object



26
# File 'lib/ruby_lsp/operandi/indexing_enhancement.rb', line 26

def on_call_node_leave(node); end