-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[internal] [request] Refactor handling of Coq execution in requests
- Loading branch information
Showing
11 changed files
with
99 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,10 @@ | ||
(** Several todos here in terms of usability *) | ||
|
||
let code = -32803 | ||
|
||
let print_err ~uri e = | ||
match e with | ||
| Coq.Protect.Error.Anomaly (_loc, msg) | User (_loc, msg) -> | ||
Format.asprintf "Error when saving %s: %a" | ||
(Lang.LUri.File.to_string_file uri) | ||
Pp.pp_with msg | ||
|
||
let request ~doc = | ||
match Fleche.Doc.save ~doc with | ||
| { Coq.Protect.E.r = Interrupted; _ } -> | ||
Error (code, "save operation interrupted") | ||
| { Coq.Protect.E.r = Completed (Error e); _ } -> | ||
let error_msg = print_err ~uri:doc.uri e in | ||
Error (code, error_msg) | ||
| { Coq.Protect.E.r = Completed (Ok ()); _ } -> Ok `Null | ||
let open Coq.Protect.E.O in | ||
let f () = | ||
(* XXX: What do do with feedback, return to user? *) | ||
let+ () = Fleche.Doc.save ~doc in | ||
Ok `Null | ||
in | ||
Request.R.of_execution ~name:"save" ~f () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters