2
0
Эх сурвалжийг харах

[display] support hover on import/using sub-type

closes #7060
Simon Krajewski 7 жил өмнө
parent
commit
c64737211f

+ 9 - 0
src/typing/typeload.ml

@@ -784,6 +784,15 @@ let handle_path_display ctx path p =
 			with Not_found ->
 				()
 			end
+		| (IDKSubType(sl,sm,st),p),DMHover ->
+			(* TODO: remove code duplication once load_type_def change is in *)
+			let m = ctx.g.do_load_module ctx (sl,sm) p in
+			begin try
+				let mt = List.find (fun mt -> snd (t_infos mt).mt_path = st) m.m_types in
+				DisplayEmitter.display_module_type ctx mt p;
+			with Not_found ->
+				()
+			end
 		| (IDKModule(sl,s),_),_ ->
 			raise (Parser.TypePath(sl,Some(s,false),true))
 		| (IDKSubType(sl,sm,st),p),DMDefinition ->

+ 14 - 0
tests/display/src/cases/Issue7060.hx

@@ -0,0 +1,14 @@
+package cases;
+
+class Issue7060 extends DisplayTestCase {
+	/**
+	import Type.Valu{-1-}eType;
+
+	class Main {
+		static function main() {}
+	}
+	**/
+	function test() {
+		eq("ValueType", type(pos(1)));
+	}
+}