moduleMyGemclassMyAddon<Addondefactivate# Perform any relevant initializationenddefname"My addon name"endendend
Attributes
addon_classes (attr_reader)
addons (attr_accessor)
file_watcher_addons (attr_accessor)
Public Class Methods
inherited(child_class)
Calls superclass method
# File lib/ruby_lsp/addon.rb, line 47definherited(child_class)
addon_classes<<child_classsuperend
load_addons(global_state, outgoing_queue)
# File lib/ruby_lsp/addon.rb, line 54defload_addons(global_state, outgoing_queue)
# Require all addons entry points, which should be placed under# `some_gem/lib/ruby_lsp/your_gem_name/addon.rb`Gem.find_files("ruby_lsp/**/addon.rb").eachdo|addon|requireFile.expand_path(addon)
rescue=>e$stderr.puts(e.full_message)
end# Instantiate all discovered addon classesself.addons = addon_classes.map(&:new)
self.file_watcher_addons = addons.select { |addon|addon.respond_to?(:workspace_did_change_watched_files) }
# Activate each one of the discovered addons. If any problems occur in the addons, we don't want to# fail to boot the serveraddons.eachdo|addon|addon.activate(global_state, outgoing_queue)
rescue=>eaddon.add_error(e)
endend
new()
# File lib/ruby_lsp/addon.rb, line 78definitialize@errors = T.let([], T::Array[StandardError])
end
Public Instance Methods
activate(global_state, outgoing_queue)
# File lib/ruby_lsp/addon.rb, line 109defactivate(global_state, outgoing_queue); end
add_error(error)
# File lib/ruby_lsp/addon.rb, line 83defadd_error(error)
@errors<<errorselfend
backtraces()
# File lib/ruby_lsp/addon.rb, line 102defbacktraces@errors.filter_map(&:backtrace).join("\n\n")
end