Class: RubyLsp::Listener

Inherits:
Object
  • Object
show all
Extended by:
T::Generic, T::Helpers, T::Sig
Includes:
Requests::Support::Common
Defined in:
lib/ruby_lsp/listener.rb

Overview

Listener is an abstract class to be used by requests for listening to events emitted when visiting an AST using the EventEmitter.

Constant Summary collapse

ResponseType =
type_member

Instance Method Summary collapse

Methods included from Requests::Support::Common

#create_code_lens, #full_constant_name, #range_from_syntax_tree_node, #visible?

Constructor Details

#initialize(emitter, message_queue) ⇒ Listener

Returns a new instance of Listener.



18
19
20
21
22
# File 'lib/ruby_lsp/listener.rb', line 18

def initialize(emitter, message_queue)
  @emitter = emitter
  @message_queue = message_queue
  @external_listeners = T.let([], T::Array[RubyLsp::Listener[ResponseType]])
end

Instance Method Details

#merge_external_listeners_responses!Object



32
33
34
# File 'lib/ruby_lsp/listener.rb', line 32

def merge_external_listeners_responses!
  @external_listeners.each { |l| merge_response!(l) }
end

#merge_response!(other) ⇒ Object



39
40
41
# File 'lib/ruby_lsp/listener.rb', line 39

def merge_response!(other)
  self
end

#responseObject



27
# File 'lib/ruby_lsp/listener.rb', line 27

def response; end