Browse Source

[display] fix class path explorer file removal

see #8643
Simon Krajewski 6 years ago
parent
commit
1c257aaa7d

+ 4 - 0
src/context/compilationServer.ml

@@ -159,6 +159,10 @@ let remove_file cs key =
 		Hashtbl.replace cs.cache.c_removed_files key ()
 		Hashtbl.replace cs.cache.c_removed_files key ()
 	end
 	end
 
 
+(* Like remove_file, but doesn't keep track of the file *)
+let remove_file_for_real cs key =
+	Hashtbl.remove cs.cache.c_files key
+
 let remove_files cs file =
 let remove_files cs file =
 	List.iter (fun (sign,_) -> remove_file cs (file,sign)) cs.signs
 	List.iter (fun (sign,_) -> remove_file cs (file,sign)) cs.signs
 
 

+ 1 - 0
src/context/display/displayJson.ml

@@ -193,6 +193,7 @@ let handler =
 			let sign = Digest.from_hex (hctx.jsonrpc#get_string_param "signature") in
 			let sign = Digest.from_hex (hctx.jsonrpc#get_string_param "signature") in
 			let files = CompilationServer.get_files hctx.display#get_cs in
 			let files = CompilationServer.get_files hctx.display#get_cs in
 			let files = Hashtbl.fold (fun (file,sign') decls acc -> if sign = sign' then (file,decls) :: acc else acc) files [] in
 			let files = Hashtbl.fold (fun (file,sign') decls acc -> if sign = sign' then (file,decls) :: acc else acc) files [] in
+			let files = List.sort (fun (file1,_) (file2,_) -> compare file1 file2) files in
 			let files = List.map (fun (file,cfile) ->
 			let files = List.map (fun (file,cfile) ->
 				jobject [
 				jobject [
 					"file",jstring file;
 					"file",jstring file;

+ 1 - 1
src/context/display/displayToplevel.ml

@@ -79,7 +79,7 @@ let read_class_paths com timer =
 		match CompilationServer.get() with
 		match CompilationServer.get() with
 		| Some cs when pack <> fst path ->
 		| Some cs when pack <> fst path ->
 			let file = Path.unique_full_path file in
 			let file = Path.unique_full_path file in
-			CompilationServer.remove_file cs (file,sign)
+			CompilationServer.remove_file_for_real cs (file,sign)
 		| _ ->
 		| _ ->
 			()
 			()
 	)
 	)