Class: RubyLsp::RSpec::Definition
- Inherits:
-
Object
- Object
- RubyLsp::RSpec::Definition
- Includes:
- RubyLsp::Requests::Support::Common
- Defined in:
- lib/ruby_lsp/ruby_lsp_rspec/definition.rb
Instance Method Summary collapse
-
#initialize(response_builder, uri, node_context, index, dispatcher) ⇒ Definition
constructor
: (ResponseBuilders::CollectionResponseBuilder[Interface::LocationLink | Interface::Location], URI::Generic, NodeContext, RubyIndexer::Index, Prism::Dispatcher) -> void.
-
#on_call_node_enter(node) ⇒ Object
: (Prism::CallNode) -> void.
Constructor Details
#initialize(response_builder, uri, node_context, index, dispatcher) ⇒ Definition
: (ResponseBuilders::CollectionResponseBuilder[Interface::LocationLink | Interface::Location], URI::Generic, NodeContext, RubyIndexer::Index, Prism::Dispatcher) -> void
10 11 12 13 14 15 16 |
# File 'lib/ruby_lsp/ruby_lsp_rspec/definition.rb', line 10 def initialize(response_builder, uri, node_context, index, dispatcher) @response_builder = response_builder @uri = uri @node_context = node_context @index = index dispatcher.register(self, :on_call_node_enter) end |
Instance Method Details
#on_call_node_enter(node) ⇒ Object
: (Prism::CallNode) -> void
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ruby_lsp/ruby_lsp_rspec/definition.rb', line 19 def on_call_node_enter(node) = node. return unless return if @node_context.locals_for_scope.include?() entries = @index[] return unless entries return if entries.empty? entries.each do |entry| # Technically, let can be defined in a different file, but we're not going to handle that case yet next unless entry.file_path == @uri.to_standardized_path @response_builder << Interface::LocationLink.new( target_uri: entry.uri, target_range: range_from_location(entry.location), target_selection_range: range_from_location(entry.name_location), ) end end |