From 14e1e297ff1a41c074c5bb6b72095e3472c3c754 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 26 Jan 2018 15:12:31 -0600 Subject: [PATCH] make many functions of `Client.t` optional in `Client.make` (see #4) --- src/Client.ml | 9 +++++---- src/Client.mli | 14 ++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Client.ml b/src/Client.ml index 6028d03..9ade934 100644 --- a/src/Client.ml +++ b/src/Client.ml @@ -84,12 +84,13 @@ module Kernel = struct ?(file_extension=".txt") ?mime_type ?(init=fun () -> Lwt.return_unit) + ?(is_complete=fun _ -> Lwt.return Is_complete) + ?(complete=fun ~pos i-> + Lwt.return {completion_matches=[]; completion_start=pos;completion_end=pos}) + ?(inspect=fun _ -> Lwt.return (Error "no inspection implemented")) + ?(history=fun _ -> Lwt.return []) ~language_version ~language - ~is_complete - ~complete - ~inspect - ~history ~exec () : t = { banner; file_extension; mime_type; language; language_version; diff --git a/src/Client.mli b/src/Client.mli index c3a55ad..0cad6be 100644 --- a/src/Client.mli +++ b/src/Client.mli @@ -21,6 +21,12 @@ module Kernel : sig type exec_action = | Mime of mime_data_bundle + (* TODO: + make the [exec] return type be asynchronous + - return [Ok str] as a future + - return a stream of actions + *) + type exec_status_ok = { msg: string option; (* main message *) @@ -75,12 +81,12 @@ module Kernel : sig ?file_extension:string -> ?mime_type:string -> ?init:(unit -> unit Lwt.t) -> + ?is_complete:(string -> is_complete_reply Lwt.t) -> + ?complete:(pos:int -> string -> completion_status Lwt.t) -> + ?inspect: (inspect_request -> inspect_reply_ok or_error Lwt.t) -> + ?history:(history_request -> string list Lwt.t) -> language_version:int list -> language:string -> - is_complete:(string -> is_complete_reply Lwt.t) -> - complete:(pos:int -> string -> completion_status Lwt.t) -> - inspect: (inspect_request -> inspect_reply_ok or_error Lwt.t) -> - history:(history_request -> string list Lwt.t) -> exec:(count:int -> string -> exec_status_ok or_error Lwt.t) -> unit -> t