Improve editor parsable errors

This commit is contained in:
Denis Merigoux 2023-04-18 09:49:12 +02:00
parent 75c2a24b98
commit 4f7564b079
No known key found for this signature in database
GPG Key ID: EE99DCFA365C3EE3
2 changed files with 6 additions and 5 deletions

View File

@ -38,17 +38,17 @@ let print_structured_error (msg : string) (pos : (string option * Pos.t) list) :
pos))
| Cli.EditorParsable ->
let remove_new_lines s =
Re.replace ~all:true (Re.compile (Re.char '\n')) ~f:(fun _ -> " | ") s
Re.replace ~all:true (Re.compile (Re.char '\n')) ~f:(fun _ -> " · ") s
in
"\n"
remove_new_lines msg
^ "\n"
^ String.concat "\n"
(List.map
(fun (msg', pos) ->
Printf.sprintf "%s%s" (Pos.to_string_short pos)
(match msg' with
| None -> remove_new_lines msg
| Some msg' ->
remove_new_lines msg ^ " | " ^ remove_new_lines msg'))
| None -> ""
| Some msg' -> remove_new_lines msg'))
pos)
(** {1 Error exception and printing} *)

View File

@ -22,6 +22,7 @@ let _ =
language = Some (Js.to_string language);
max_prec_digits = None;
closure_conversion = false;
message_format = Human;
trace;
disable_warnings = true;
disable_counterexamples = false;