Class: RubyLsp::Mongoid::Addon

Inherits:
Addon
  • Object
show all
Includes:
SignatureResolver
Defined in:
lib/ruby_lsp/ruby_lsp_mongoid/addon.rb

Constant Summary

Constants included from SignatureResolver

SignatureResolver::CLASS_METHOD_SOURCES, SignatureResolver::CORE_CLASS_METHODS, SignatureResolver::CORE_INSTANCE_METHODS, SignatureResolver::INSTANCE_METHOD_SOURCES

Instance Method Summary collapse

Methods included from SignatureResolver

#resolve_class_method_signature, #resolve_instance_method_signature

Instance Method Details

#activate(global_state, outgoing_queue) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/ruby_lsp/ruby_lsp_mongoid/addon.rb', line 13

def activate(global_state, outgoing_queue)
  @global_state = global_state
  @outgoing_queue = outgoing_queue
  @outgoing_queue << Notification.window_log_message("Activating Ruby LSP Mongoid add-on v#{VERSION}")

  # Start background thread to update signatures after indexing completes
  @signature_update_thread = Thread.new { wait_for_indexing_and_update_signatures }
end

#create_hover_listener(response_builder, node_context, dispatcher) ⇒ Object



34
35
36
37
38
# File 'lib/ruby_lsp/ruby_lsp_mongoid/addon.rb', line 34

def create_hover_listener(response_builder, node_context, dispatcher)
  return unless @global_state

  Hover.new(response_builder, node_context, @global_state.index, dispatcher)
end

#deactivate ⇒ Object



22
23
24
# File 'lib/ruby_lsp/ruby_lsp_mongoid/addon.rb', line 22

def deactivate
  @signature_update_thread&.kill
end

#name ⇒ Object



26
27
28
# File 'lib/ruby_lsp/ruby_lsp_mongoid/addon.rb', line 26

def name
  "Ruby LSP Mongoid"
end

#version ⇒ Object



30
31
32
# File 'lib/ruby_lsp/ruby_lsp_mongoid/addon.rb', line 30

def version
  VERSION
end