Commit f4579d83 authored by DAILLER Sylvain's avatar DAILLER Sylvain

Merge branch 'issue_371_ide_slow_syntax_erros' into 'master'

Issue 371 ide slow syntax erros

Closes #371

See merge request !213
parents c05154d9 c59a224b
...@@ -1346,6 +1346,16 @@ end ...@@ -1346,6 +1346,16 @@ end
Ident.Hid.clear th_to_node_ID; Ident.Hid.clear th_to_node_ID;
Hfile.clear file_to_node_ID Hfile.clear file_to_node_ID
let notify_parsing_errors l =
List.iter
(function (loc,rel_loc,s) ->
P.notify (Message (Parse_Or_Type_Error(loc,rel_loc,s))))
l
(* Save the last parsing errors that occured. Report them when an invalid
command (transformation/etc) is entered before reloading. *)
let parsing_errors = ref []
let reload_session () : unit = let reload_session () : unit =
let d = get_server_data () in let d = get_server_data () in
(* interrupt all running provers and unfocus before reload *) (* interrupt all running provers and unfocus before reload *)
...@@ -1356,16 +1366,16 @@ end ...@@ -1356,16 +1366,16 @@ end
let l = reload_files d.cont let l = reload_files d.cont
~shape_version:(Some Termcode.current_shape_version) ~shape_version:(Some Termcode.current_shape_version)
in in
reset_and_send_the_whole_tree ();
match l with match l with
| [] -> | [] ->
(* TODO: try to restore the previous focus : focused_node := old_focus; *) (* TODO: try to restore the previous focus : focused_node := old_focus; *)
(* Only reset the tree when there is no errors (for efficiency of ide) *)
parsing_errors := [];
reset_and_send_the_whole_tree ();
P.notify (Message (Information "Session refresh successful")) P.notify (Message (Information "Session refresh successful"))
| l -> | l ->
List.iter parsing_errors := l;
(function (loc,rel_loc,s) -> notify_parsing_errors l
P.notify (Message (Parse_Or_Type_Error(loc,rel_loc,s))))
l
let replay ~valid_only nid : unit = let replay ~valid_only nid : unit =
let d = get_server_data () in let d = get_server_data () in
...@@ -1598,6 +1608,14 @@ end ...@@ -1598,6 +1608,14 @@ end
(* Check that the request does not refer to obsolete node_ids *) (* Check that the request does not refer to obsolete node_ids *)
if not (request_is_valid r) then if not (request_is_valid r) then
begin begin
if !parsing_errors <> [] then begin
(* There were parsing errors and no reloads. *)
P.notify (Message (Error "Cannot handle this command while the \
parsing error is not resolved. You can try \
reloading the session or removing detached \
files."));
notify_parsing_errors !parsing_errors
end;
(* These errors come from the client-server behavior of itp. They cannot (* These errors come from the client-server behavior of itp. They cannot
be completely avoided and could be safely ignored. be completely avoided and could be safely ignored.
They are ignored if a debug flag is not added. They are ignored if a debug flag is not added.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment