Commit df8b07cd authored by MARCHE Claude's avatar MARCHE Claude

IDE: new specific color name for error lines

parent b8a1acd5
......@@ -50,6 +50,7 @@ type t =
mutable neg_premise_color : string;
mutable goal_color : string;
mutable error_color : string;
mutable error_line_color : string;
mutable iconset : string;
(** colors *)
mutable config : Whyconf.config;
......@@ -84,6 +85,7 @@ type ide = {
ide_neg_premise_color : string;
ide_goal_color : string;
ide_error_color : string;
ide_error_line_color : string;
ide_iconset : string;
(* ide_replace_prover : conf_replace_prover; *)
ide_hidden_provers : string list;
......@@ -108,7 +110,8 @@ let default_ide =
ide_premise_color = "chartreuse";
ide_neg_premise_color = "pink";
ide_goal_color = "gold";
ide_error_color = "orange";
ide_error_color = "red";
ide_error_line_color = "yellow";
ide_iconset = "fatcow";
ide_hidden_provers = [];
}
......@@ -160,6 +163,9 @@ let load_ide section =
ide_error_color =
get_string section ~default:default_ide.ide_error_color
"error_color";
ide_error_line_color =
get_string section ~default:default_ide.ide_error_line_color
"error_line_color";
ide_iconset =
get_string section ~default:default_ide.ide_iconset
"iconset";
......@@ -204,6 +210,7 @@ let load_config config original_config =
neg_premise_color = ide.ide_neg_premise_color;
goal_color = ide.ide_goal_color;
error_color = ide.ide_error_color;
error_line_color = ide.ide_error_line_color;
iconset = ide.ide_iconset;
config = config;
original_config = original_config;
......@@ -248,6 +255,7 @@ let save_config t =
let ide = set_string ide "neg_premise_color" t.neg_premise_color in
let ide = set_string ide "goal_color" t.goal_color in
let ide = set_string ide "error_color" t.error_color in
let ide = set_string ide "error_line_color" t.error_line_color in
let ide = set_string ide "iconset" t.iconset in
let config = Whyconf.set_section config "ide" ide in
Whyconf.save_config config
......
......@@ -31,6 +31,7 @@ type t =
mutable neg_premise_color : string;
mutable goal_color : string;
mutable error_color : string;
mutable error_line_color : string;
mutable iconset : string;
mutable config : Whyconf.config;
original_config : Whyconf.config;
......
......@@ -245,18 +245,18 @@ let try_convert s =
let create_colors v =
let premise_tag (v: GSourceView2.source_view) = v#buffer#create_tag
~name:"premise_tag" [`BACKGROUND gconfig.premise_color] in
let neg_premise_tag (v: GSourceView2.source_view) = v#buffer#create_tag
~name:"neg_premise_tag" [`BACKGROUND gconfig.neg_premise_color] in
let goal_tag (v: GSourceView2.source_view) = v#buffer#create_tag
~name:"goal_tag" [`BACKGROUND gconfig.goal_color] in
let error_line_tag (v: GSourceView2.source_view) = v#buffer#create_tag
~name:"error_line_tag" [`BACKGROUND gconfig.error_line_color] in
let error_tag (v: GSourceView2.source_view) = v#buffer#create_tag
~name:"error_tag" [`BACKGROUND gconfig.neg_premise_color] in
~name:"error_tag" [`BACKGROUND gconfig.error_color] in
let _ : GText.tag = premise_tag v in
let _ : GText.tag = neg_premise_tag v in
let _ : GText.tag = goal_tag v in
let _ : GText.tag = error_line_tag v in
let _ : GText.tag = error_tag v in
()
......@@ -266,7 +266,8 @@ let erase_color_loc (v:GSourceView2.source_view) =
buf#remove_tag_by_name "premise_tag" ~start:buf#start_iter ~stop:buf#end_iter;
buf#remove_tag_by_name "neg_premise_tag" ~start:buf#start_iter ~stop:buf#end_iter;
buf#remove_tag_by_name "goal_tag" ~start:buf#start_iter ~stop:buf#end_iter;
buf#remove_tag_by_name "error_tag" ~start:buf#start_iter ~stop:buf#end_iter
buf#remove_tag_by_name "error_tag" ~start:buf#start_iter ~stop:buf#end_iter;
buf#remove_tag_by_name "error_line_tag" ~start:buf#start_iter ~stop:buf#end_iter
......@@ -946,7 +947,7 @@ let log_zone =
(* Create a tag for errors in the message zone. *)
let message_zone_error_tag = message_zone#buffer#create_tag
~name:"error" [`BACKGROUND gconfig.neg_premise_color]
~name:"error" [`BACKGROUND gconfig.error_line_color]
(**** Message-zone printing functions *****)
......@@ -1156,6 +1157,7 @@ let convert_color (color: color): string =
| Premise_color -> "premise_tag"
| Goal_color -> "goal_tag"
| Error_color -> "error_tag"
| Error_line_color -> "error_line_tag"
let move_to_line ~yalign (v : GSourceView2.source_view) line =
let line = max 0 (line - 1) in
......@@ -1690,9 +1692,8 @@ let treat_message_notification msg = match msg with
| Parse_Or_Type_Error (loc, rel_loc, s) ->
if gconfig.allow_source_editing || !initialization_complete then
begin
(* TODO find a new color *)
scroll_to_loc ~force_tab_switch:true (Some (rel_loc,0));
color_line ~color:Goal_color rel_loc;
color_line ~color:Error_line_color rel_loc;
color_loc ~color:Error_color rel_loc;
print_message ~kind:1 ~notif_kind:"Parse_Or_Type_Error" "%s" s
end
......
......@@ -66,6 +66,7 @@ type color =
| Premise_color
| Goal_color
| Error_color
| Error_line_color
type update_info =
| Proved of bool
......
......@@ -75,6 +75,7 @@ type color =
| Premise_color
| Goal_color
| Error_color
| Error_line_color
type update_info =
| Proved of bool
......
......@@ -284,7 +284,8 @@ let convert_color (color: color) : Json_base.json =
| Neg_premise_color -> "Neg_premise_color"
| Premise_color -> "Premise_color"
| Goal_color -> "Goal_color"
| Error_color -> "Error_color")
| Error_color -> "Error_color"
| Error_line_color -> "Error_line_color")
let convert_loc_color (loc,color: Loc.position * color) : Json_base.json =
let loc = convert_loc loc in
......@@ -303,6 +304,7 @@ let parse_color (j: json) : color =
| String "Premise_color" -> Premise_color
| String "Goal_color" -> Goal_color
| String "Error_color" -> Error_color
| String "Error_line_color" -> Error_line_color
| _ -> raise Notcolor
exception Notposition
......
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