Module Sexp_grammar_completion_protocol.Rpc_complete

Complete requests a completion.

The client and server must agree out-of-band about the grammar to be used.

The division of labor between client and server is as follows:

1. The client determines the current sexp and current atom. It sends the server a prefix of the current sexp, excluding the current atom. 2. The server returns all candidates consistent with the current sexp. 3. The client additionally filters for consistency with the current atom.

Steps 1 and 3 happen on the client so we can use editor-specific APIs to improve latency and user experience. E.g., the client may know that only the atom prefix has been edited, and avoid an unnecessary call to the server. Or the client can display and incrementally refine the candidates using an editor-specific fuzzy matching API.

See Candidate.matches_atom_prefix for a default implementation of step 3.

Step 2 happens on the server so that the editor need not link an up-to-date grammar. The server may also know more about the semantics of the sexp being edited, and use that to implement better completion than would be possible using the grammar alone.

1 Preceding complete sexps are ignored because the sexp grammar completion model does not take advantage of that information.

type query = Prefix.t
val compare_query : query -> query -> int
val sexp_of_query : query -> Sexplib0.Sexp.t
val query_of_sexp : Sexplib0.Sexp.t -> query
type response = Candidates.t
val compare_response : response -> response -> int
val sexp_of_response : response -> Sexplib0.Sexp.t
include Async_rpc_kernel.Versioned_rpc.Both_convert.Plain.S with type callee_query := query with type callee_response := response with type caller_query := query with type caller_response := response
val implement_multi : ?log_not_previously_seen_version:(name:string -> int -> unit) -> ('state -> version:int -> query -> response Async_kernel.Deferred.t) -> 'state Async_rpc_kernel.Rpc.Implementation.t list

implement multiple versions at once

val rpcs : unit -> Async_rpc_kernel.Rpc.Any.t list

All supported rpcs.

val versions : unit -> Core.Int.Set.t

All supported versions. Useful for detecting old versions that may be pruned.

val name : string