class RubyLsp::Requests::Definition
“‘
Product.new # <- Request go to definition on this class name will take you to its declaration.
require “some_gem/file” # <- Request go to definition on this string will take you to the file
“`ruby
# Example
- Methods invoked on self only
- Require paths
- Constants
- Modules
- Classes
Currently supported targets:
definition of the symbol under the cursor.
request](microsoft.github.io/language-server-protocol/specification#textDocument_definition) jumps to the
The [definition

def initialize(document, index, position, dispatcher, typechecker_enabled)
def initialize(document, index, position, dispatcher, typechecker_enabled) super() @response_builder = T.let( ResponseBuilders::CollectionResponseBuilder[Interface::Location].new, ResponseBuilders::CollectionResponseBuilder[Interface::Location], ) target, parent, nesting = document.locate_node( position, node_types: [Prism::CallNode, Prism::ConstantReadNode, Prism::ConstantPathNode], ) target = parent if target.is_a?(Prism::ConstantReadNode) && parent.is_a?(Prism::ConstantPathNode) Listeners::Definition.new(@response_builder, document.uri, nesting, index, dispatcher, typechecker_enabled) Addon.addons.each do |addon| addon.create_definition_listener(@response_builder, document.uri, nesting, index, dispatcher) end @target = T.let(target, T.nilable(Prism::Node)) @dispatcher = dispatcher end
def perform
def perform @dispatcher.dispatch_once(@target) @response_builder.response end