Vcaml_plugin.Persistentmodule Rpc : sig ... endval create :
?on_crash:(Core.Error.t -> unit Async.Deferred.t) ->
?after_startup:
('state ->
client:[ `asynchronous ] Vcaml.Client.t ->
unit Async.Deferred.Or_error.t) ->
name:string ->
description:string ->
on_startup:
([ `asynchronous ] Vcaml.Client.t -> 'state Async.Deferred.Or_error.t) ->
notify_fn:[ `Lua of string | `Viml of string ] ->
'state Rpc.t list ->
Core.Command.tCreate a command to invoke from Neovim to start this persistent plugin. The plugin will not shut down on its own - you must call exit or let Neovim SIGTERM the plugin when it exits. The on_crash handler can be used to do something with an unexpected error just before the plugin crashes - you may want to use this to send the error to some logging service.
notify_fn specifies a function that will be called after on_startup. It is used to communicate to Neovim that the plugin is ready. The function is passed the channel ID as an argument, which is needed to send RPC requests to the plugin.
Any RPCs that are invoked before on_startup has returned will return an error. This can happen if there is logic inside on_startup that enables Neovim to invoke RPCs (a common example is setting up autocmds that invoke RPCs on certain events). Any such logic should be moved to after_startup to avoid racing with state initialization.
val create' :
?on_crash:(Core.Error.t -> unit Async.Deferred.t) ->
?after_startup:
('state ->
client:[ `asynchronous ] Vcaml.Client.t ->
unit Async.Deferred.Or_error.t) ->
name:string ->
description:string ->
param:'param Core.Command.Param.t ->
on_startup:
('param ->
client:[ `asynchronous ] Vcaml.Client.t ->
'state Async.Deferred.Or_error.t) ->
notify_fn:[ `Lua of string | `Viml of string ] ->
'state Rpc.t list ->
Core.Command.tSame as create but allows you to specify parameters for the generated command.