Class: RubyLsp::RSpec::Addon

Inherits:
Addon
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/ruby_lsp/ruby_lsp_rspec/addon.rb

Instance Method Summary collapse

Instance Method Details

#activate(global_state, message_queue) ⇒ Object



18
19
20
21
# File 'lib/ruby_lsp/ruby_lsp_rspec/addon.rb', line 18

def activate(global_state, message_queue)
  @index = T.let(global_state.index, T.nilable(RubyIndexer::Index))
  global_state.index.register_enhancement(IndexingEnhancement.new(global_state.index))
end

#create_code_lens_listener(response_builder, uri, dispatcher) ⇒ Object



39
40
41
42
43
# File 'lib/ruby_lsp/ruby_lsp_rspec/addon.rb', line 39

def create_code_lens_listener(response_builder, uri, dispatcher)
  return unless uri.to_standardized_path&.end_with?("_test.rb") || uri.to_standardized_path&.end_with?("_spec.rb")

  CodeLens.new(response_builder, uri, dispatcher)
end

#create_definition_listener(response_builder, uri, node_context, dispatcher) ⇒ Object



66
67
68
69
70
# File 'lib/ruby_lsp/ruby_lsp_rspec/addon.rb', line 66

def create_definition_listener(response_builder, uri, node_context, dispatcher)
  return unless uri.to_standardized_path&.end_with?("_test.rb") || uri.to_standardized_path&.end_with?("_spec.rb")

  Definition.new(response_builder, uri, node_context, T.must(@index), dispatcher)
end

#create_document_symbol_listener(response_builder, dispatcher) ⇒ Object



51
52
53
# File 'lib/ruby_lsp/ruby_lsp_rspec/addon.rb', line 51

def create_document_symbol_listener(response_builder, dispatcher)
  DocumentSymbol.new(response_builder, dispatcher)
end

#deactivateObject



24
# File 'lib/ruby_lsp/ruby_lsp_rspec/addon.rb', line 24

def deactivate; end

#nameObject



73
74
75
# File 'lib/ruby_lsp/ruby_lsp_rspec/addon.rb', line 73

def name
  "Ruby LSP RSpec"
end

#versionObject



27
28
29
# File 'lib/ruby_lsp/ruby_lsp_rspec/addon.rb', line 27

def version
  VERSION
end