Class: RubyLsp::Doclinks::Hover
- Inherits:
-
Object
- Object
- RubyLsp::Doclinks::Hover
- Includes:
- Requests::Support::Common
- Defined in:
- lib/ruby_lsp/doclinks/addon.rb
Instance Method Summary collapse
-
#initialize(settings, response_builder, dispatcher) ⇒ Hover
constructor
A new instance of Hover.
- #on_call_node_enter(node) ⇒ Object
- #on_constant_path_node_enter(node) ⇒ Object
- #on_constant_read_node_enter(node) ⇒ Object
Constructor Details
#initialize(settings, response_builder, dispatcher) ⇒ Hover
Returns a new instance of Hover.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ruby_lsp/doclinks/addon.rb', line 53 def initialize(settings, response_builder, dispatcher) @settings = settings @response_builder = response_builder # Subscribe to various node types dispatcher.register(self, :on_constant_read_node_enter) dispatcher.register(self, :on_constant_path_node_enter) dispatcher.register(self, :on_call_node_enter) end |
Instance Method Details
#on_call_node_enter(node) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/ruby_lsp/doclinks/addon.rb', line 75 def on_call_node_enter(node) # Handle method calls constant = node.receiver&.slice method = node.name handle_constant(constant, method) end |
#on_constant_path_node_enter(node) ⇒ Object
69 70 71 72 73 |
# File 'lib/ruby_lsp/doclinks/addon.rb', line 69 def on_constant_path_node_enter(node) # Handle nested constants like Foo::Bar constant = node.slice handle_constant(constant) end |
#on_constant_read_node_enter(node) ⇒ Object
64 65 66 67 |
# File 'lib/ruby_lsp/doclinks/addon.rb', line 64 def on_constant_read_node_enter(node) constant = node.slice handle_constant(constant) end |