···20202121exception Timeout
22222323+let log s = Js_of_ocaml.Firebug.console##log (Js_of_ocaml.Js.string s)
2424+2325let demux context msg =
2426 Lwt.async (fun () ->
2527 match Queue.take_opt context.waiting with
···2729 | Some (mv, outstanding_execution) ->
2830 Brr.G.stop_timer outstanding_execution;
2931 let msg : string = Message.Ev.data (Brr.Ev.as_type msg) in
3030- Lwt_mvar.put mv (Ok (Marshal.from_string msg 0)))
3232+ log (Printf.sprintf "Client received: %s" msg);
3333+ Lwt_mvar.put mv (Ok (Jsonrpc.response_of_string msg)))
31343235let rpc : context -> Rpc.call -> Rpc.response Lwt.t =
3336 fun context call ->
3437 let open Lwt in
3535- let jv = Marshal.to_bytes call [] in
3838+ let jv = Jsonrpc.string_of_call call in
3939+ log (Printf.sprintf "Client sending: %s" jv);
3640 let mv = Lwt_mvar.create_empty () in
3741 let outstanding_execution =
3842 Brr.G.set_timeout ~ms:context.timeout (fun () ->
+302
idl/jsonrpc.ml
···11+(*
22+ * Copyright (c) 2006-2009 Citrix Systems Inc.
33+ * Copyright (c) 2006-2014 Thomas Gazagnaire <thomas@gazagnaire.org>
44+ *
55+ * Permission to use, copy, modify, and distribute this software for any
66+ * purpose with or without fee is hereby granted, provided that the above
77+ * copyright notice and this permission notice appear in all copies.
88+ *
99+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1010+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1111+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1212+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1313+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1414+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616+ *)
1717+1818+open Rpc
1919+2020+module Yojson_private = struct
2121+ include Yojson.Safe
2222+2323+ let from_string ?(strict = true) ?buf ?fname ?lnum s =
2424+ let open Yojson in
2525+ try
2626+ let lexbuf = Lexing.from_string s in
2727+ let v = init_lexer ?buf ?fname ?lnum () in
2828+ if strict then from_lexbuf v lexbuf else from_lexbuf v ~stream:true lexbuf
2929+ with
3030+ | End_of_input -> json_error "Blank input data"
3131+end
3232+3333+module Y = Yojson_private
3434+module U = Yojson.Basic.Util
3535+3636+type version =
3737+ | V1
3838+ | V2
3939+4040+let rec rpc_to_json t =
4141+ match t with
4242+ | Int i -> `Intlit (Int64.to_string i)
4343+ | Int32 i -> `Int (Int32.to_int i)
4444+ | Bool b -> `Bool b
4545+ | Float r -> `Float r
4646+ | String s -> `String s
4747+ | DateTime d -> `String d
4848+ | Base64 b -> `String b
4949+ | Null -> `Null
5050+ | Enum a -> `List (Rpcmarshal.tailrec_map rpc_to_json a)
5151+ | Dict a -> `Assoc (Rpcmarshal.tailrec_map (fun (k, v) -> k, rpc_to_json v) a)
5252+5353+5454+exception JsonToRpcError of Y.t
5555+5656+let rec json_to_rpc t =
5757+ match t with
5858+ | `Intlit i -> Int (Int64.of_string i)
5959+ | `Int i -> Int (Int64.of_int i)
6060+ | `Bool b -> Bool b
6161+ | `Float r -> Float r
6262+ | `String s -> (* TODO: check if it is a DateTime *) String s
6363+ (* | DateTime d -> `String d *)
6464+ (* | Base64 b -> `String b *)
6565+ | `Null -> Null
6666+ | `List a -> Enum (Rpcmarshal.tailrec_map json_to_rpc a)
6767+ | `Assoc a -> Dict (Rpcmarshal.tailrec_map (fun (k, v) -> k, json_to_rpc v) a)
6868+ | unsupported -> raise (JsonToRpcError unsupported)
6969+7070+7171+let to_fct t f = rpc_to_json t |> Y.to_string |> f
7272+let to_buffer t buf = to_fct t (fun s -> Buffer.add_string buf s)
7373+let to_string t = rpc_to_json t |> Y.to_string
7474+7575+let to_a ~empty ~append t =
7676+ let buf = empty () in
7777+ to_fct t (fun s -> append buf s);
7878+ buf
7979+8080+8181+let new_id =
8282+ let count = ref 0L in
8383+ fun () ->
8484+ count := Int64.add 1L !count;
8585+ !count
8686+8787+8888+let string_of_call ?(version = V1) call =
8989+ let json =
9090+ match version with
9191+ | V1 -> [ "method", String call.name; "params", Enum call.params ]
9292+ | V2 ->
9393+ let params =
9494+ match call.params with
9595+ | [ Dict x ] -> Dict x
9696+ | _ -> Enum call.params
9797+ in
9898+ [ "jsonrpc", String "2.0"; "method", String call.name; "params", params ]
9999+ in
100100+ let json =
101101+ if not call.is_notification then json @ [ "id", Int (new_id ()) ] else json
102102+ in
103103+ to_string (Dict json)
104104+105105+106106+let json_of_response ?(id = Int 0L) version response =
107107+ if response.Rpc.success
108108+ then (
109109+ match version with
110110+ | V1 -> Dict [ "result", response.Rpc.contents; "error", Null; "id", id ]
111111+ | V2 -> Dict [ "jsonrpc", String "2.0"; "result", response.Rpc.contents; "id", id ])
112112+ else (
113113+ match version with
114114+ | V1 -> Dict [ "result", Null; "error", response.Rpc.contents; "id", id ]
115115+ | V2 -> Dict [ "jsonrpc", String "2.0"; "error", response.Rpc.contents; "id", id ])
116116+117117+118118+let json_of_error_object ?(data = None) code message =
119119+ let data_json =
120120+ match data with
121121+ | Some d -> [ "data", d ]
122122+ | None -> []
123123+ in
124124+ Dict ([ "code", Int code; "message", String message ] @ data_json)
125125+126126+127127+let string_of_response ?(id = Int 0L) ?(version = V1) response =
128128+ let json = json_of_response ~id version response in
129129+ to_string json
130130+131131+132132+let a_of_response ?(id = Int 0L) ?(version = V1) ~empty ~append response =
133133+ let json = json_of_response ~id version response in
134134+ to_a ~empty ~append json
135135+136136+137137+let of_string ?(strict = true) s = s |> Y.from_string ~strict |> json_to_rpc
138138+139139+let of_a ~next_char b =
140140+ let buf = Buffer.create 2048 in
141141+ let rec acc () =
142142+ match next_char b with
143143+ | Some c ->
144144+ Buffer.add_char buf c;
145145+ acc ()
146146+ | None -> ()
147147+ in
148148+ acc ();
149149+ Buffer.contents buf |> of_string
150150+151151+152152+let get' name dict =
153153+ try Some (List.assoc name dict) with
154154+ | Not_found -> None
155155+156156+157157+exception Malformed_method_request of string
158158+exception Malformed_method_response of string
159159+exception Missing_field of string
160160+161161+let get name dict =
162162+ match get' name dict with
163163+ | None ->
164164+ if Rpc.get_debug () then Printf.eprintf "%s was not found in the dictionary\n" name;
165165+ raise (Missing_field name)
166166+ | Some v -> v
167167+168168+169169+let version_id_and_call_of_string_option str =
170170+ try
171171+ match of_string str with
172172+ | Dict d ->
173173+ let name =
174174+ match get "method" d with
175175+ | String s -> s
176176+ | _ -> raise (Malformed_method_request "Invalid field 'method' in request body")
177177+ in
178178+ let version =
179179+ match get' "jsonrpc" d with
180180+ | None -> V1
181181+ | Some (String "2.0") -> V2
182182+ | _ -> raise (Malformed_method_request "Invalid field 'jsonrpc' in request body")
183183+ in
184184+ let params =
185185+ match version with
186186+ | V1 ->
187187+ (match get "params" d with
188188+ | Enum l -> l
189189+ | _ -> raise (Malformed_method_request "Invalid field 'params' in request body"))
190190+ | V2 ->
191191+ (match get' "params" d with
192192+ | None | Some Null -> []
193193+ | Some (Enum l) -> l
194194+ | Some (Dict l) -> [ Dict l ]
195195+ | _ -> raise (Malformed_method_request "Invalid field 'params' in request body"))
196196+ in
197197+ let id =
198198+ match get' "id" d with
199199+ | None | Some Null -> None (* is a notification *)
200200+ | Some (Int a) -> Some (Int a)
201201+ | Some (String a) -> Some (String a)
202202+ | Some _ -> raise (Malformed_method_request "Invalid field 'id' in request body")
203203+ in
204204+ let c = call name params in
205205+ version, id, { c with is_notification = id == None }
206206+ | _ -> raise (Malformed_method_request "Invalid request body")
207207+ with
208208+ | Missing_field field ->
209209+ raise (Malformed_method_request (Printf.sprintf "Required field %s is missing" field))
210210+ | JsonToRpcError json ->
211211+ raise
212212+ (Malformed_method_request (Printf.sprintf "Unable to parse %s" (Y.to_string json)))
213213+214214+215215+let version_id_and_call_of_string s =
216216+ let version, id_, call = version_id_and_call_of_string_option s in
217217+ match id_ with
218218+ | Some id -> version, id, call
219219+ | None -> raise (Malformed_method_request "Invalid field 'id' in request body")
220220+221221+222222+let call_of_string str =
223223+ let _, _, call = version_id_and_call_of_string str in
224224+ call
225225+226226+227227+(* This functions parses the json and tries to extract a valid jsonrpc response
228228+ * (See http://www.jsonrpc.org/ for the exact specs). *)
229229+let get_response extractor str =
230230+ try
231231+ match extractor str with
232232+ | Dict d ->
233233+ let _ =
234234+ match get "id" d with
235235+ | Int _ as x -> x
236236+ | String _ as y -> y
237237+ | _ -> raise (Malformed_method_response "id")
238238+ in
239239+ (match get' "jsonrpc" d with
240240+ | None ->
241241+ let result = get "result" d in
242242+ let error = get "error" d in
243243+ (match result, error with
244244+ | v, Null -> success v
245245+ | Null, v -> failure v
246246+ | x, y ->
247247+ raise
248248+ (Malformed_method_response
249249+ (Printf.sprintf
250250+ "<result=%s><error=%s>"
251251+ (Rpc.to_string x)
252252+ (Rpc.to_string y))))
253253+ | Some (String "2.0") ->
254254+ let result = get' "result" d in
255255+ let error = get' "error" d in
256256+ (match result, error with
257257+ | Some v, None -> success v
258258+ | None, Some v ->
259259+ (match v with
260260+ | Dict err ->
261261+ let (_ : int64) =
262262+ match get "code" err with
263263+ | Int i -> i
264264+ | _ -> raise (Malformed_method_response "Error code")
265265+ in
266266+ let _ =
267267+ match get "message" err with
268268+ | String s -> s
269269+ | _ -> raise (Malformed_method_response "Error message")
270270+ in
271271+ failure v
272272+ | _ -> raise (Malformed_method_response "Error object"))
273273+ | Some x, Some y ->
274274+ raise
275275+ (Malformed_method_response
276276+ (Printf.sprintf
277277+ "<result=%s><error=%s>"
278278+ (Rpc.to_string x)
279279+ (Rpc.to_string y)))
280280+ | None, None ->
281281+ raise
282282+ (Malformed_method_response
283283+ (Printf.sprintf "neither <result> nor <error> was found")))
284284+ | _ -> raise (Malformed_method_response "jsonrpc"))
285285+ | rpc ->
286286+ raise
287287+ (Malformed_method_response
288288+ (Printf.sprintf "<response_of_stream(%s)>" (to_string rpc)))
289289+ with
290290+ | Missing_field field ->
291291+ raise (Malformed_method_response (Printf.sprintf "<%s was not found>" field))
292292+ | JsonToRpcError json ->
293293+ raise
294294+ (Malformed_method_response
295295+ (Printf.sprintf "<unable to parse %s>" (Y.to_string json)))
296296+297297+298298+let response_of_string ?(strict = true) str = get_response (of_string ~strict) str
299299+300300+let response_of_in_channel channel =
301301+ let of_channel s = s |> Y.from_channel |> json_to_rpc in
302302+ get_response of_channel channel
+9
idl/toplevel_api.ml
···66type highlight = { line1 : int; line2 : int; col1 : int; col2 : int }
77[@@deriving rpcty]
88(** An area to be highlighted *)
99+type encoding = Mime_printer.encoding = | Noencoding | Base64 [@@deriving rpcty]
1010+1111+type mime_val = Mime_printer.t = {
1212+ mime_type : string;
1313+ encoding : encoding;
1414+ data : string;
1515+}
1616+[@@deriving rpcty]
9171018type exec_result = {
1119 stdout : string option;
···1321 sharp_ppf : string option;
1422 caml_ppf : string option;
1523 highlight : highlight option;
2424+ mime_vals : mime_val list;
1625}
1726[@@deriving rpcty]
1827(** Represents the result of executing a toplevel phrase *)
+203-43
idl/toplevel_api_gen.ml
···2626include
2727 struct
2828 let _ = fun (_ : highlight) -> ()
2929- let rec (highlight_line1 : (_, highlight) Rpc.Types.field) =
2929+ let rec highlight_line1 : (_, highlight) Rpc.Types.field =
3030 {
3131 Rpc.Types.fname = "line1";
3232 Rpc.Types.field = (let open Rpc.Types in Basic Int);
···3636 Rpc.Types.fget = (fun _r -> _r.line1);
3737 Rpc.Types.fset = (fun v -> fun _s -> { _s with line1 = v })
3838 }
3939- and (highlight_line2 : (_, highlight) Rpc.Types.field) =
3939+ and highlight_line2 : (_, highlight) Rpc.Types.field =
4040 {
4141 Rpc.Types.fname = "line2";
4242 Rpc.Types.field = (let open Rpc.Types in Basic Int);
···4646 Rpc.Types.fget = (fun _r -> _r.line2);
4747 Rpc.Types.fset = (fun v -> fun _s -> { _s with line2 = v })
4848 }
4949- and (highlight_col1 : (_, highlight) Rpc.Types.field) =
4949+ and highlight_col1 : (_, highlight) Rpc.Types.field =
5050 {
5151 Rpc.Types.fname = "col1";
5252 Rpc.Types.field = (let open Rpc.Types in Basic Int);
···5656 Rpc.Types.fget = (fun _r -> _r.col1);
5757 Rpc.Types.fset = (fun v -> fun _s -> { _s with col1 = v })
5858 }
5959- and (highlight_col2 : (_, highlight) Rpc.Types.field) =
5959+ and highlight_col2 : (_, highlight) Rpc.Types.field =
6060 {
6161 Rpc.Types.fname = "col2";
6262 Rpc.Types.field = (let open Rpc.Types in Basic Int);
···116116 and _ = typ_of_highlight
117117 and _ = highlight
118118 end[@@ocaml.doc "@inline"][@@merlin.hide ]
119119+type encoding = Mime_printer.encoding =
120120+ | Noencoding
121121+ | Base64 [@@ocaml.doc " An area to be highlighted "][@@deriving rpcty]
122122+include
123123+ struct
124124+ let _ = fun (_ : encoding) -> ()
125125+ let rec typ_of_encoding =
126126+ Rpc.Types.Variant
127127+ ({
128128+ Rpc.Types.vname = "encoding";
129129+ Rpc.Types.variants =
130130+ [BoxedTag
131131+ {
132132+ Rpc.Types.tname = "Noencoding";
133133+ Rpc.Types.tcontents = Unit;
134134+ Rpc.Types.tversion = None;
135135+ Rpc.Types.tdescription = [];
136136+ Rpc.Types.tpreview =
137137+ ((function | Noencoding -> Some () | _ -> None));
138138+ Rpc.Types.treview = ((function | () -> Noencoding))
139139+ };
140140+ BoxedTag
141141+ {
142142+ Rpc.Types.tname = "Base64";
143143+ Rpc.Types.tcontents = Unit;
144144+ Rpc.Types.tversion = None;
145145+ Rpc.Types.tdescription = [];
146146+ Rpc.Types.tpreview =
147147+ ((function | Base64 -> Some () | _ -> None));
148148+ Rpc.Types.treview = ((function | () -> Base64))
149149+ }];
150150+ Rpc.Types.vdefault = None;
151151+ Rpc.Types.vversion = None;
152152+ Rpc.Types.vconstructor =
153153+ (fun s' ->
154154+ fun t ->
155155+ let s = String.lowercase_ascii s' in
156156+ match s with
157157+ | "noencoding" ->
158158+ Rresult.R.bind (t.tget Unit)
159159+ (function | () -> Rresult.R.ok Noencoding)
160160+ | "base64" ->
161161+ Rresult.R.bind (t.tget Unit)
162162+ (function | () -> Rresult.R.ok Base64)
163163+ | _ ->
164164+ Rresult.R.error_msg
165165+ (Printf.sprintf "Unknown tag '%s'" s))
166166+ } : encoding Rpc.Types.variant)
167167+ and encoding =
168168+ {
169169+ Rpc.Types.name = "encoding";
170170+ Rpc.Types.description = ["An area to be highlighted"];
171171+ Rpc.Types.ty = typ_of_encoding
172172+ }
173173+ let _ = typ_of_encoding
174174+ and _ = encoding
175175+ end[@@ocaml.doc "@inline"][@@merlin.hide ]
176176+type mime_val = Mime_printer.t =
177177+ {
178178+ mime_type: string ;
179179+ encoding: encoding ;
180180+ data: string }[@@deriving rpcty]
181181+include
182182+ struct
183183+ let _ = fun (_ : mime_val) -> ()
184184+ let rec mime_val_mime_type : (_, mime_val) Rpc.Types.field =
185185+ {
186186+ Rpc.Types.fname = "mime_type";
187187+ Rpc.Types.field = (let open Rpc.Types in Basic String);
188188+ Rpc.Types.fdefault = None;
189189+ Rpc.Types.fdescription = [];
190190+ Rpc.Types.fversion = None;
191191+ Rpc.Types.fget = (fun _r -> _r.mime_type);
192192+ Rpc.Types.fset = (fun v -> fun _s -> { _s with mime_type = v })
193193+ }
194194+ and mime_val_encoding : (_, mime_val) Rpc.Types.field =
195195+ {
196196+ Rpc.Types.fname = "encoding";
197197+ Rpc.Types.field = typ_of_encoding;
198198+ Rpc.Types.fdefault = None;
199199+ Rpc.Types.fdescription = [];
200200+ Rpc.Types.fversion = None;
201201+ Rpc.Types.fget = (fun _r -> _r.encoding);
202202+ Rpc.Types.fset = (fun v -> fun _s -> { _s with encoding = v })
203203+ }
204204+ and mime_val_data : (_, mime_val) Rpc.Types.field =
205205+ {
206206+ Rpc.Types.fname = "data";
207207+ Rpc.Types.field = (let open Rpc.Types in Basic String);
208208+ Rpc.Types.fdefault = None;
209209+ Rpc.Types.fdescription = [];
210210+ Rpc.Types.fversion = None;
211211+ Rpc.Types.fget = (fun _r -> _r.data);
212212+ Rpc.Types.fset = (fun v -> fun _s -> { _s with data = v })
213213+ }
214214+ and typ_of_mime_val =
215215+ Rpc.Types.Struct
216216+ ({
217217+ Rpc.Types.fields =
218218+ [Rpc.Types.BoxedField mime_val_mime_type;
219219+ Rpc.Types.BoxedField mime_val_encoding;
220220+ Rpc.Types.BoxedField mime_val_data];
221221+ Rpc.Types.sname = "mime_val";
222222+ Rpc.Types.version = None;
223223+ Rpc.Types.constructor =
224224+ (fun getter ->
225225+ let open Rresult.R in
226226+ (getter.Rpc.Types.field_get "data"
227227+ (let open Rpc.Types in Basic String))
228228+ >>=
229229+ (fun mime_val_data ->
230230+ (getter.Rpc.Types.field_get "encoding" typ_of_encoding)
231231+ >>=
232232+ (fun mime_val_encoding ->
233233+ (getter.Rpc.Types.field_get "mime_type"
234234+ (let open Rpc.Types in Basic String))
235235+ >>=
236236+ (fun mime_val_mime_type ->
237237+ return
238238+ {
239239+ mime_type = mime_val_mime_type;
240240+ encoding = mime_val_encoding;
241241+ data = mime_val_data
242242+ }))))
243243+ } : mime_val Rpc.Types.structure)
244244+ and mime_val =
245245+ {
246246+ Rpc.Types.name = "mime_val";
247247+ Rpc.Types.description = [];
248248+ Rpc.Types.ty = typ_of_mime_val
249249+ }
250250+ let _ = mime_val_mime_type
251251+ and _ = mime_val_encoding
252252+ and _ = mime_val_data
253253+ and _ = typ_of_mime_val
254254+ and _ = mime_val
255255+ end[@@ocaml.doc "@inline"][@@merlin.hide ]
119256type exec_result =
120257 {
121258 stdout: string option ;
122259 stderr: string option ;
123260 sharp_ppf: string option ;
124261 caml_ppf: string option ;
125125- highlight: highlight option }[@@deriving rpcty][@@ocaml.doc
126126- " Represents the result of executing a toplevel phrase "]
262262+ highlight: highlight option ;
263263+ mime_vals: mime_val list }[@@deriving rpcty][@@ocaml.doc
264264+ " Represents the result of executing a toplevel phrase "]
127265include
128266 struct
129267 let _ = fun (_ : exec_result) -> ()
130130- let rec (exec_result_stdout : (_, exec_result) Rpc.Types.field) =
268268+ let rec exec_result_stdout : (_, exec_result) Rpc.Types.field =
131269 {
132270 Rpc.Types.fname = "stdout";
133271 Rpc.Types.field =
···138276 Rpc.Types.fget = (fun _r -> _r.stdout);
139277 Rpc.Types.fset = (fun v -> fun _s -> { _s with stdout = v })
140278 }
141141- and (exec_result_stderr : (_, exec_result) Rpc.Types.field) =
279279+ and exec_result_stderr : (_, exec_result) Rpc.Types.field =
142280 {
143281 Rpc.Types.fname = "stderr";
144282 Rpc.Types.field =
···149287 Rpc.Types.fget = (fun _r -> _r.stderr);
150288 Rpc.Types.fset = (fun v -> fun _s -> { _s with stderr = v })
151289 }
152152- and (exec_result_sharp_ppf : (_, exec_result) Rpc.Types.field) =
290290+ and exec_result_sharp_ppf : (_, exec_result) Rpc.Types.field =
153291 {
154292 Rpc.Types.fname = "sharp_ppf";
155293 Rpc.Types.field =
···160298 Rpc.Types.fget = (fun _r -> _r.sharp_ppf);
161299 Rpc.Types.fset = (fun v -> fun _s -> { _s with sharp_ppf = v })
162300 }
163163- and (exec_result_caml_ppf : (_, exec_result) Rpc.Types.field) =
301301+ and exec_result_caml_ppf : (_, exec_result) Rpc.Types.field =
164302 {
165303 Rpc.Types.fname = "caml_ppf";
166304 Rpc.Types.field =
···171309 Rpc.Types.fget = (fun _r -> _r.caml_ppf);
172310 Rpc.Types.fset = (fun v -> fun _s -> { _s with caml_ppf = v })
173311 }
174174- and (exec_result_highlight : (_, exec_result) Rpc.Types.field) =
312312+ and exec_result_highlight : (_, exec_result) Rpc.Types.field =
175313 {
176314 Rpc.Types.fname = "highlight";
177315 Rpc.Types.field = (Rpc.Types.Option typ_of_highlight);
···180318 Rpc.Types.fversion = None;
181319 Rpc.Types.fget = (fun _r -> _r.highlight);
182320 Rpc.Types.fset = (fun v -> fun _s -> { _s with highlight = v })
321321+ }
322322+ and exec_result_mime_vals : (_, exec_result) Rpc.Types.field =
323323+ {
324324+ Rpc.Types.fname = "mime_vals";
325325+ Rpc.Types.field = (Rpc.Types.List typ_of_mime_val);
326326+ Rpc.Types.fdefault = None;
327327+ Rpc.Types.fdescription = [];
328328+ Rpc.Types.fversion = None;
329329+ Rpc.Types.fget = (fun _r -> _r.mime_vals);
330330+ Rpc.Types.fset = (fun v -> fun _s -> { _s with mime_vals = v })
183331 }
184332 and typ_of_exec_result =
185333 Rpc.Types.Struct
···189337 Rpc.Types.BoxedField exec_result_stderr;
190338 Rpc.Types.BoxedField exec_result_sharp_ppf;
191339 Rpc.Types.BoxedField exec_result_caml_ppf;
192192- Rpc.Types.BoxedField exec_result_highlight];
340340+ Rpc.Types.BoxedField exec_result_highlight;
341341+ Rpc.Types.BoxedField exec_result_mime_vals];
193342 Rpc.Types.sname = "exec_result";
194343 Rpc.Types.version = None;
195344 Rpc.Types.constructor =
196345 (fun getter ->
197346 let open Rresult.R in
198198- (getter.Rpc.Types.field_get "highlight"
199199- (Rpc.Types.Option typ_of_highlight))
347347+ (getter.Rpc.Types.field_get "mime_vals"
348348+ (Rpc.Types.List typ_of_mime_val))
200349 >>=
201201- (fun exec_result_highlight ->
202202- (getter.Rpc.Types.field_get "caml_ppf"
203203- (Rpc.Types.Option
204204- (let open Rpc.Types in Basic String)))
350350+ (fun exec_result_mime_vals ->
351351+ (getter.Rpc.Types.field_get "highlight"
352352+ (Rpc.Types.Option typ_of_highlight))
205353 >>=
206206- (fun exec_result_caml_ppf ->
207207- (getter.Rpc.Types.field_get "sharp_ppf"
354354+ (fun exec_result_highlight ->
355355+ (getter.Rpc.Types.field_get "caml_ppf"
208356 (Rpc.Types.Option
209357 (let open Rpc.Types in Basic String)))
210358 >>=
211211- (fun exec_result_sharp_ppf ->
212212- (getter.Rpc.Types.field_get "stderr"
359359+ (fun exec_result_caml_ppf ->
360360+ (getter.Rpc.Types.field_get "sharp_ppf"
213361 (Rpc.Types.Option
214362 (let open Rpc.Types in Basic String)))
215363 >>=
216216- (fun exec_result_stderr ->
217217- (getter.Rpc.Types.field_get "stdout"
364364+ (fun exec_result_sharp_ppf ->
365365+ (getter.Rpc.Types.field_get "stderr"
218366 (Rpc.Types.Option
219367 (let open Rpc.Types in
220368 Basic String)))
221369 >>=
222222- (fun exec_result_stdout ->
223223- return
224224- {
225225- stdout = exec_result_stdout;
226226- stderr = exec_result_stderr;
227227- sharp_ppf =
228228- exec_result_sharp_ppf;
229229- caml_ppf =
230230- exec_result_caml_ppf;
231231- highlight =
232232- exec_result_highlight
233233- }))))))
370370+ (fun exec_result_stderr ->
371371+ (getter.Rpc.Types.field_get
372372+ "stdout"
373373+ (Rpc.Types.Option
374374+ (let open Rpc.Types in
375375+ Basic String)))
376376+ >>=
377377+ (fun exec_result_stdout ->
378378+ return
379379+ {
380380+ stdout =
381381+ exec_result_stdout;
382382+ stderr =
383383+ exec_result_stderr;
384384+ sharp_ppf =
385385+ exec_result_sharp_ppf;
386386+ caml_ppf =
387387+ exec_result_caml_ppf;
388388+ highlight =
389389+ exec_result_highlight;
390390+ mime_vals =
391391+ exec_result_mime_vals
392392+ })))))))
234393 } : exec_result Rpc.Types.structure)
235394 and exec_result =
236395 {
···244403 and _ = exec_result_sharp_ppf
245404 and _ = exec_result_caml_ppf
246405 and _ = exec_result_highlight
406406+ and _ = exec_result_mime_vals
247407 and _ = typ_of_exec_result
248408 and _ = exec_result
249409 end[@@ocaml.doc "@inline"][@@merlin.hide ]
···257417include
258418 struct
259419 let _ = fun (_ : completion_result) -> ()
260260- let rec (completion_result_n : (_, completion_result) Rpc.Types.field) =
420420+ let rec completion_result_n : (_, completion_result) Rpc.Types.field =
261421 {
262422 Rpc.Types.fname = "n";
263423 Rpc.Types.field = (let open Rpc.Types in Basic Int);
···269429 Rpc.Types.fget = (fun _r -> _r.n);
270430 Rpc.Types.fset = (fun v -> fun _s -> { _s with n = v })
271431 }
272272- and (completion_result_completions :
273273- (_, completion_result) Rpc.Types.field) =
432432+ and completion_result_completions :
433433+ (_, completion_result) Rpc.Types.field =
274434 {
275435 Rpc.Types.fname = "completions";
276436 Rpc.Types.field =
···325485include
326486 struct
327487 let _ = fun (_ : cma) -> ()
328328- let rec (cma_url : (_, cma) Rpc.Types.field) =
488488+ let rec cma_url : (_, cma) Rpc.Types.field =
329489 {
330490 Rpc.Types.fname = "url";
331491 Rpc.Types.field = (let open Rpc.Types in Basic String);
···335495 Rpc.Types.fget = (fun _r -> _r.url);
336496 Rpc.Types.fset = (fun v -> fun _s -> { _s with url = v })
337497 }
338338- and (cma_fn : (_, cma) Rpc.Types.field) =
498498+ and cma_fn : (_, cma) Rpc.Types.field =
339499 {
340500 Rpc.Types.fname = "fn";
341501 Rpc.Types.field = (let open Rpc.Types in Basic String);
···382542include
383543 struct
384544 let _ = fun (_ : init_libs) -> ()
385385- let rec (init_libs_cmi_urls : (_, init_libs) Rpc.Types.field) =
545545+ let rec init_libs_cmi_urls : (_, init_libs) Rpc.Types.field =
386546 {
387547 Rpc.Types.fname = "cmi_urls";
388548 Rpc.Types.field =
···393553 Rpc.Types.fget = (fun _r -> _r.cmi_urls);
394554 Rpc.Types.fset = (fun v -> fun _s -> { _s with cmi_urls = v })
395555 }
396396- and (init_libs_cmas : (_, init_libs) Rpc.Types.field) =
556556+ and init_libs_cmas : (_, init_libs) Rpc.Types.field =
397557 {
398558 Rpc.Types.fname = "cmas";
399559 Rpc.Types.field = (Rpc.Types.List typ_of_cma);