소스 검색

[server] bring back dms_per_file for diagnostics/statistics

Simon Krajewski 3 년 전
부모
커밋
8f39a2ca28
2개의 변경된 파일14개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/compiler/displayOutput.ml
  2. 12 0
      tests/server/src/cases/ServerTests.hx

+ 2 - 2
src/compiler/displayOutput.ml

@@ -255,11 +255,11 @@ let handle_display_argument com file_pos actx =
 			| "diagnostics" ->
 				com.report_mode <- RMDiagnostics [file_unique];
 				let dm = create DMNone in
-				{dm with dms_display_file_policy = DFPAlso}
+				{dm with dms_display_file_policy = DFPAlso; dms_per_file = true}
 			| "statistics" ->
 				com.report_mode <- RMStatistics;
 				let dm = create DMNone in
-				{dm with dms_display_file_policy = DFPAlso; dms_error_policy = EPIgnore}
+				{dm with dms_display_file_policy = DFPAlso; dms_error_policy = EPIgnore; dms_per_file = true}
 			| "signature" ->
 				create DMSignature
 			| "" ->

+ 12 - 0
tests/server/src/cases/ServerTests.hx

@@ -160,6 +160,18 @@ class ServerTests extends TestCase {
 		assertReuse("HelloWorld");
 	}
 
+	function testDiagnosticsRecache3() {
+		vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
+		var args = ["--main", "HelloWorld", "--interp"];
+		runHaxe(args);
+		runHaxe(args);
+		assertReuse("HelloWorld");
+	 	runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("HelloWorld.hx")});
+		runHaxe(args.concat(["--display", "HelloWorld.hx@0@diagnostics"]));
+		runHaxe(args.concat(["--display", "HelloWorld.hx@0@hover"]));
+		assertReuse("HelloWorld");
+	}
+
 	function testSyntaxCache() {
 		vfs.putContent("HelloWorld.hx", getTemplate("HelloWorld.hx"));
 		runHaxeJson(["-cp", "."], ServerMethods.ReadClassPaths, null);