Class: RubyLsp::Listeners::Definition
- Inherits:
-
RubyLsp::Listener
- Object
- RubyLsp::Listener
- RubyLsp::Listeners::Definition
- Extended by:
- T::Generic, T::Sig
- Defined in:
- lib/ruby_lsp/listeners/definition.rb
Constant Summary collapse
- ResponseType =
type_member { { fixed: T.nilable(T.any(T::Array[Interface::Location], Interface::Location)) } }
Instance Attribute Summary collapse
-
#_response ⇒ Object
readonly
Returns the value of attribute _response.
Instance Method Summary collapse
-
#initialize(uri, nesting, index, dispatcher, typechecker_enabled) ⇒ Definition
constructor
A new instance of Definition.
- #on_call_node_enter(node) ⇒ Object
- #on_constant_path_node_enter(node) ⇒ Object
- #on_constant_read_node_enter(node) ⇒ Object
Methods inherited from RubyLsp::Listener
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(uri, nesting, index, dispatcher, typechecker_enabled) ⇒ Definition
Returns a new instance of Definition.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ruby_lsp/listeners/definition.rb', line 24 def initialize(uri, nesting, index, dispatcher, typechecker_enabled) @uri = uri @nesting = nesting @index = index @typechecker_enabled = typechecker_enabled @_response = T.let(nil, ResponseType) super(dispatcher) dispatcher.register( self, :on_call_node_enter, :on_constant_read_node_enter, :on_constant_path_node_enter, ) end |
Instance Attribute Details
#_response ⇒ Object (readonly)
Returns the value of attribute _response.
13 14 15 |
# File 'lib/ruby_lsp/listeners/definition.rb', line 13 def _response @_response end |
Instance Method Details
#on_call_node_enter(node) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/ruby_lsp/listeners/definition.rb', line 42 def on_call_node_enter(node) = node.name if == :require || == :require_relative handle_require_definition(node) else handle_method_definition(node) end end |
#on_constant_path_node_enter(node) ⇒ Object
53 54 55 |
# File 'lib/ruby_lsp/listeners/definition.rb', line 53 def on_constant_path_node_enter(node) find_in_index(node.slice) end |
#on_constant_read_node_enter(node) ⇒ Object
58 59 60 |
# File 'lib/ruby_lsp/listeners/definition.rb', line 58 def on_constant_read_node_enter(node) find_in_index(node.slice) end |