Module Vcaml.Buf
type t= Vcaml__.Types.Buf.t
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
module Table : Core.Hashtbl.S with type key = ttype mark={row : int;col : int;}type which_buffer=[|`Current|`Numbered of t]
module Event : sig ... endval of_msgpack : Msgpack.t -> t Core.Or_error.tval to_msgpack : t -> Msgpack.tval get_name : buffer:t -> string Core.Or_error.t Api_call.tval get_lines : buffer:t -> start:int -> end_:int -> strict_indexing:bool -> string list Core.Or_error.t Api_call.tval set_lines : buffer:t -> start:int -> end_:int -> strict_indexing:bool -> replacement:string list -> unit Core.Or_error.t Api_call.tval attach : ?opts:(Msgpack.t * Msgpack.t) list -> Vcaml__.Types.client -> buffer:which_buffer -> send_buffer:bool -> Event.t Async.Pipe.Reader.t Async.Deferred.Or_error.tAttach to an existing buffer and receive a pipe of updates pretaining to this buffer.
The
optsparameter is currently unused but may become used by neovim in the future.This function returns a regular
Deferred.tinstead of anapi_callbecause it is impossible to execute atomically -- due to potential race conditions between multiple attaches and detaches, this function is written as multiple api calls to neovim that are sequenced according toThrottle.Sequencer. This has the side effect of potentially running Async cycles during execution, which may in turn invoke other neovim operations, violating the atomicity guarantee ofApi_call.Attaching to a buffer is unlikely to race with anything. The only operation that may interfere with the buffer attach is if the buffer is deleted or otherwise stops broadcasting while the attach is in flight. Depending on the exact ordering, then, one of two things may happen:
- If the delete occurs before the attach completes, then the attach will fail with a ``nonexistent buffer'' error.
- If the attach completes first, then it will receive a detach message immediately and close itself.
Both cases are ones the application should be prepared to handle.
nvim_buf_detachisn't directly exposed because it would detach all attached clients. Instead, simply close the returned pipe.
module Untested : sig ... end