瀏覽代碼

[display] don't show Module.platform.hx in import completion (closes #6408)

Simon Krajewski 8 年之前
父節點
當前提交
894f7f4574
共有 2 個文件被更改,包括 12 次插入1 次删除
  1. 4 1
      src/display/displayOutput.ml
  2. 8 0
      tests/display/src/cases/IImport.hx

+ 4 - 1
src/display/displayOutput.ml

@@ -285,7 +285,10 @@ module TypePathHandler = struct
 					end;
 				end else if file_extension f = "hx" then begin
 					let c = Filename.chop_extension f in
-					if String.length c < 2 || String.sub c (String.length c - 2) 2 <> "__" then classes := c :: !classes;
+					try
+						ignore(String.index c '.')
+					with Not_found ->
+						if String.length c < 2 || String.sub c (String.length c - 2) 2 <> "__" then classes := c :: !classes;
 				end;
 			) r;
 		) com.class_path;

+ 8 - 0
tests/display/src/cases/IImport.hx

@@ -56,4 +56,12 @@ class IImport extends DisplayTestCase {
 		eq(false, hasPath(fields(pos(1)), "run"));
 		eq(true, hasPath(fields(pos(1)), "Serializer"));
 	}
+
+	/**
+	import haxe.macro.{-1-}
+	**/
+	function testIssue6408() {
+		eq(true, hasPath(fields(pos(1)), "Context"));
+		eq(false, hasPath(fields(pos(1)), "Context.hl"));
+	}
 }