ソースを参照

[display] don't try to load everything in macro mode

closes #9383
Simon Krajewski 5 年 前
コミット
219194de3e
2 ファイル変更22 行追加1 行削除
  1. 2 1
      src/compiler/haxe.ml
  2. 20 0
      tests/server/src/cases/display/issues/Issue9383.hx

+ 2 - 1
src/compiler/haxe.ml

@@ -558,7 +558,8 @@ let handle_display ctx tctx display_file_dot_path =
 	if ctx.com.display.dms_exit_during_typing then begin
 	if ctx.com.display.dms_exit_during_typing then begin
 		if ctx.has_next || ctx.has_error then raise Abort;
 		if ctx.has_next || ctx.has_error then raise Abort;
 		(* If we didn't find a completion point, load the display file in macro mode. *)
 		(* If we didn't find a completion point, load the display file in macro mode. *)
-		ignore(load_display_module_in_macro tctx display_file_dot_path true);
+		if com.display_information.display_module_has_macro_defines then
+			ignore(load_display_module_in_macro tctx display_file_dot_path true);
 		let no_completion_point_found = "No completion point was found" in
 		let no_completion_point_found = "No completion point was found" in
 		match com.json_out with
 		match com.json_out with
 		| Some _ -> (match ctx.com.display.dms_kind with
 		| Some _ -> (match ctx.com.display.dms_kind with

+ 20 - 0
tests/server/src/cases/display/issues/Issue9383.hx

@@ -0,0 +1,20 @@
+package cases.display.issues;
+
+class Issue9383 extends DisplayTestCase {
+	/**
+		class Main {
+			static function main() {
+				{-1-}
+			}
+		}
+	**/
+	function test(_) {
+		runHaxeJson(["-v"], DisplayMethods.SignatureHelp, {
+			file: file,
+			offset: offset(1),
+			wasAutoTriggered: false,
+		});
+		Assert.isFalse(Lambda.exists(messages, msg -> msg.contains("Typing macro Main.main")));
+		Assert.isFalse(Lambda.exists(messages, msg -> msg.contains("Typing macro")));
+	}
+}