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 = t
type mark
=
{
row : int;
col : int;
}
type which_buffer
=[
|
`Current
|
`Numbered of t
]
module Event : sig ... end
val of_msgpack : Msgpack.t -> t Core.Or_error.t
val to_msgpack : t -> Msgpack.t
val get_name : buffer:t -> string Core.Or_error.t Api_call.t
val get_lines : buffer:t -> start:int -> end_:int -> strict_indexing:bool -> string list Core.Or_error.t Api_call.t
val set_lines : buffer:t -> start:int -> end_:int -> strict_indexing:bool -> replacement:string list -> unit Core.Or_error.t Api_call.t
val 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.t
Attach to an existing buffer and receive a pipe of updates pretaining to this buffer.
The
opts
parameter is currently unused but may become used by neovim in the future.This function returns a regular
Deferred.t
instead of anapi_call
because 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_detach
isn't directly exposed because it would detach all attached clients. Instead, simply close the returned pipe.
module Untested : sig ... end