Class: Neovim::Host
Instance Attribute Summary collapse
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
Class Method Summary collapse
-
.load_from_files(rplugin_paths, target_manifest = Manifest.new) ⇒ Host
Load plugin definitions and instantiate a new
Host
.
Instance Method Summary collapse
-
#initialize(manifest, session = nil) ⇒ Host
constructor
A new instance of Host.
-
#run ⇒ void
Run the event loop, passing received messages to the manifest.
Methods included from Logging
Constructor Details
Instance Attribute Details
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
8 9 10 |
# File 'lib/neovim/host.rb', line 8 def manifest @manifest end |
Class Method Details
.load_from_files(rplugin_paths) ⇒ Host .load_from_files(rplugin_paths, target_manifest) ⇒ Host
Load plugin definitions and instantiate a new Host
. This temporarily mutates global state on the Neovim
module so that Neovim.plugin
calls will be registered correctly with the provided Manifest
.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/neovim/host.rb', line 24 def self.load_from_files(rplugin_paths, target_manifest=Manifest.new) old_manifest = Neovim.__configured_plugin_manifest old_path = Neovim.__configured_plugin_path begin Neovim.__configured_plugin_manifest = target_manifest rplugin_paths.each do |rplugin_path| Neovim.__configured_plugin_path = rplugin_path Kernel.load(rplugin_path, true) end new(target_manifest) ensure Neovim.__configured_plugin_manifest = old_manifest Neovim.__configured_plugin_path = old_path end end |
Instance Method Details
#run ⇒ void
This method returns an undefined value.
Run the event loop, passing received messages to the manifest.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/neovim/host.rb', line 51 def run @session.discover_api @session.run do |msg| debug("received #{msg.inspect}") @manifest.handle(msg, client) end rescue => e fatal("got unexpected error #{e}") debug(e.backtrace.join("\n")) end |