Browse Source

[display] add null, false and true to toplevel completion (#5791)

Gama11 8 years ago
parent
commit
867df4937f
3 changed files with 9 additions and 0 deletions
  1. 2 0
      src/context/common.ml
  2. 5 0
      src/display/display.ml
  3. 2 0
      src/display/displayOutput.ml

+ 2 - 0
src/context/common.ml

@@ -207,6 +207,7 @@ module IdentifierType = struct
 		| ITGlobal of module_type * string * Type.t
 		| ITType of module_type
 		| ITPackage of string
+		| ITLiteral of string
 		| ITTimer of string
 
 	let get_name = function
@@ -216,6 +217,7 @@ module IdentifierType = struct
 		| ITGlobal(_,s,_) -> s
 		| ITType mt -> snd (t_infos mt).mt_path
 		| ITPackage s -> s
+		| ITLiteral s -> s
 		| ITTimer s -> s
 end
 

+ 5 - 0
src/display/display.ml

@@ -847,6 +847,11 @@ module ToplevelCollector = struct
 				with Not_found ->
 					()
 			) ctx.m.module_globals;
+
+			(* literals *)
+			DynArray.add acc (ITLiteral "null");
+			DynArray.add acc (ITLiteral "true");
+			DynArray.add acc (ITLiteral "false");
 		end;
 
 		let module_types = ref [] in

+ 2 - 0
src/display/displayOutput.ml

@@ -78,6 +78,8 @@ let print_toplevel il =
 			Buffer.add_string b (Printf.sprintf "<i k=\"type\" p=\"%s\"%s>%s</i>\n" (s_type_path infos.mt_path) (s_doc infos.mt_doc) (snd infos.mt_path));
 		| IdentifierType.ITPackage s ->
 			Buffer.add_string b (Printf.sprintf "<i k=\"package\">%s</i>\n" s)
+		| IdentifierType.ITLiteral s ->
+			Buffer.add_string b (Printf.sprintf "<i k=\"literal\">%s</i>\n" s)
 		| IdentifierType.ITTimer s ->
 			Buffer.add_string b (Printf.sprintf "<i k=\"timer\">%s</i>\n" s)
 	) il;