Class: RubyLsp::RbsRails::Addon
- Inherits:
-
Addon
- Object
- Addon
- RubyLsp::RbsRails::Addon
- Includes:
- LanguageServer::Protocol::Constant
- Defined in:
- lib/ruby_lsp/rbs_rails/addon.rb
Instance Attribute Summary collapse
-
#global_state ⇒ Object
readonly
: GlobalState.
-
#logger ⇒ Object
readonly
: Logger.
Instance Method Summary collapse
- #activate(global_state, message_queue) ⇒ Object
-
#deactivate ⇒ Object
: void.
-
#name ⇒ Object
: String.
-
#version ⇒ Object
: String.
- #workspace_did_change_watched_files(changes) ⇒ Object
Instance Attribute Details
#global_state ⇒ Object (readonly)
: GlobalState
14 15 16 |
# File 'lib/ruby_lsp/rbs_rails/addon.rb', line 14 def global_state @global_state end |
#logger ⇒ Object (readonly)
: Logger
15 16 17 |
# File 'lib/ruby_lsp/rbs_rails/addon.rb', line 15 def logger @logger end |
Instance Method Details
#activate(global_state, message_queue) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/ruby_lsp/rbs_rails/addon.rb', line 19 def activate(global_state, ) #: void @global_state = global_state @logger = Logger.new() load_application load_rbs_rails_config rescue LoadError logger.info("Rails application not found. Skip to activate rbs_rails addon.") end |
#deactivate ⇒ Object
: void
29 30 |
# File 'lib/ruby_lsp/rbs_rails/addon.rb', line 29 def deactivate #: void end |
#name ⇒ Object
: String
32 33 34 |
# File 'lib/ruby_lsp/rbs_rails/addon.rb', line 32 def name #: String "ruby-lsp-rbs_rails" end |
#version ⇒ Object
: String
36 37 38 |
# File 'lib/ruby_lsp/rbs_rails/addon.rb', line 36 def version #: String VERSION end |
#workspace_did_change_watched_files(changes) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ruby_lsp/rbs_rails/addon.rb', line 41 def workspace_did_change_watched_files(changes) #: void return unless defined?(::Rails) ::Rails.application.reloader.wrap do changes.each do |change| case change[:type] when FileChangeType::CREATED, FileChangeType::CHANGED generate_signature(change[:uri]) when FileChangeType::DELETED delete_signature(change[:uri]) end end end end |