Sexp_grammar_completion_protocol.Rpc_completeComplete 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.tval sexp_of_query : query -> Sexplib0.Sexp.tval query_of_sexp : Sexplib0.Sexp.t -> querytype response = Candidates.tval sexp_of_response : response -> Sexplib0.Sexp.tinclude 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 := responseval dispatch_multi :
Async_rpc_kernel.Versioned_rpc.Connection_with_menu.t ->
query ->
response Core.Or_error.t Async_kernel.Deferred.tmulti-version dispatch
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 listimplement multiple versions at once
val rpcs : unit -> Async_rpc_kernel.Rpc.Any.t listAll supported rpcs.
val versions : unit -> Core.Int.Set.tAll supported versions. Useful for detecting old versions that may be pruned.