浏览代码

[display] hide import.hx modules from package completion

They can't be imported.
closes #7911
Jens Fischer 6 年之前
父节点
当前提交
9e13a2fc63

+ 2 - 2
src/compiler/displayOutput.ml

@@ -435,7 +435,7 @@ module TypePathHandler = struct
 						else
 							packages := f :: !packages
 					end;
-				end else if file_extension f = "hx" then begin
+				end else if file_extension f = "hx" && f <> "import.hx" then begin
 					let c = Filename.chop_extension f in
 					try
 						ignore(String.index c '.')
@@ -486,7 +486,7 @@ module TypePathHandler = struct
 	let complete_type_path com p =
 		let packs, modules = read_type_path com p in
 		if packs = [] && modules = [] then
-			(abort ("No classes found in " ^ String.concat "." p) null_pos)
+			(abort ("No modules found in " ^ String.concat "." p) null_pos)
 		else
 			let packs = List.map (fun n -> make_ci_package (p,n) []) packs in
 			let modules = List.map (fun n -> make_ci_module (p,n)) modules in

+ 10 - 0
tests/display/src/cases/Issue7911.hx

@@ -0,0 +1,10 @@
+package cases;
+
+class Issue7911 extends DisplayTestCase {
+	/**
+		import misc.issue7911.{-1-}
+	**/
+	function test() {
+		arrayEq([{name: "Test", type: "", kind: "type"}], fields(pos(1)));
+	}
+}

+ 2 - 0
tests/display/src/misc/issue7911/Test.hx

@@ -0,0 +1,2 @@
+package misc.issue7911;
+

+ 2 - 0
tests/display/src/misc/issue7911/import.hx

@@ -0,0 +1,2 @@
+package misc.issue7911;
+