Kaynağa Gözat

[display] remove display file from cache if contents come in via json-rpc

Simon Krajewski 7 yıl önce
ebeveyn
işleme
91fce6631f
1 değiştirilmiş dosya ile 5 ekleme ve 1 silme
  1. 5 1
      src/context/display/displayJson.ml

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

@@ -128,16 +128,20 @@ let parse_input com input report_times pre_compilation did_something =
 		in
 		let read_display_file was_auto_triggered requires_offset is_completion =
 			let file = get_string_param "file" in
+			let file = Path.unique_full_path file in
 			let pos = if requires_offset then get_int_param "offset" else (-1) in
 			TypeloadParse.current_stdin := get_opt_param (fun () ->
 				let s = get_string_param "contents" in
 				Common.define com Define.DisplayStdin; (* TODO: awkward *)
+				let cs = CompilationServer.force() in
+				(* Remove our current display file from the cache so the server doesn't pick it up *)
+				CompilationServer.remove_files cs file;
 				Some s
 			) None;
 			Parser.was_auto_triggered := was_auto_triggered;
 			let pos = if pos <> (-1) && not is_completion then pos + 1 else pos in
 			Parser.resume_display := {
-				pfile = Path.unique_full_path file;
+				pfile = file;
 				pmin = pos;
 				pmax = pos;
 			}