소스 검색

[display] hide import.hx modules from package completion

They can't be imported.
closes #7911
Jens Fischer 6 년 전
부모
커밋
9e13a2fc63
4개의 변경된 파일16개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/compiler/displayOutput.ml
  2. 10 0
      tests/display/src/cases/Issue7911.hx
  3. 2 0
      tests/display/src/misc/issue7911/Test.hx
  4. 2 0
      tests/display/src/misc/issue7911/import.hx

+ 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;
+