File tree Expand file tree Collapse file tree 5 files changed +32
-5
lines changed
main/java/com/intellij/plugins/haxe/model
java/com/intellij/plugins/haxe/resolve
resources/testData/resolve/modules Expand file tree Collapse file tree 5 files changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,16 @@ public List<HaxeModel> getExposedMembers() {
9494
9595 return publicModels ;
9696 }
97+ @ NotNull
98+ public List <HaxeModel > getModuleMembers () {
99+ List <HaxeModel > publicModels = new ArrayList <>();
100+
101+ HaxeModule module = getModuleBody ();
102+ if (module != null && module .getModel () instanceof HaxeModuleModel model ){
103+ publicModels .addAll (model .getExposedMembers ());
104+ }
105+ return publicModels ;
106+ }
97107
98108 @ Nullable
99109 public HaxeClassModel getMainClassModel () {
Original file line number Diff line number Diff line change @@ -50,14 +50,17 @@ public FullyQualifiedInfo getQualifiedInfo() {
5050
5151 @ NotNull
5252 public List <HaxeModel > getExposedMembersInternal () {
53+ boolean isUsing = this instanceof HaxeUsingModel ; // TODO should probably do thins in a different way
5354 FullyQualifiedInfo qualifiedInfo = getQualifiedInfo ();
5455 List <HaxeModel > result ;
5556 result = HaxeProjectModel .fromElement (basePsi ).resolve (qualifiedInfo , basePsi .getResolveScope ());
5657 if (result != null && !result .isEmpty ()) {
5758 HaxeModel firstItem = result .getFirst ();
58- if (firstItem instanceof HaxeFileModel || firstItem instanceof HaxePackageModel ) {
59- result = ((HaxeExposableModel )firstItem ).getExposedMembers ();
60- }
59+ if (firstItem instanceof HaxeFileModel fileModel ) {
60+ result = isUsing ? fileModel .getModuleMembers () : fileModel .getExposedMembers ();
61+ } else if (firstItem instanceof HaxePackageModel packageModel ) {
62+ result = packageModel .getExposedMembers ();
63+ }
6164 }
6265 return result == null ? Collections .emptyList () : result ;
6366 }
Original file line number Diff line number Diff line change @@ -33,8 +33,9 @@ public void testModuleImport() {
3333 doTest (
3434 "modules/ModuleWithMainClass.hx" ,
3535 "modules/ModuleWithoutMainClass.hx" ,
36- "other/OtherModule.hx"
37- );
36+ "other/OtherModule.hx" ,
37+ "umods/UsingModule.hx"
38+ );
3839 }
3940
4041}
Original file line number Diff line number Diff line change 11package ;
22import modules .* ;
33import other .OtherModule ;
4+ using <info descr ="null ">umods .UsingModule </info >;
45
56class <info descr="null">ModuleImportTest </info> {
67 public function <info descr=" null" >new</info>() {
@@ -19,6 +20,11 @@ class <info descr="null">ModuleImportTest</info> {
1920 ModuleWithMainClass .< info descr = " null" > moduleField < / info > ;
2021 ModuleWithoutMainClass .< info descr = " null" > moduleProperty < / info > ;
2122
23+ // verify using on module return all types
24+ var <info descr = " null" > usingImportsTypedef < / info > :< info descr = " null" > MyTypeDef < / info > ;
25+ var <info descr = " null" > usingImportsSub < / info > :< info descr = " null" > SomeClassUsing < / info > ;
26+ var <info descr = " null" > usingImportsMain < / info > :< info descr = " null" > UsingModule < / info > ;
27+
2228
2329 // should resolve
2430 var <info descr = " null" > instance1 < / info > :< info descr = " null" > ModuleWithMainClass . SomeModuleClass < / info > = < info descr = " null" > new </info> <info descr=" null" >ModuleWithMainClass . SomeModuleClass </info>();
Original file line number Diff line number Diff line change 1+ package umods ;
2+
3+ typedef MyTypeDef = String ;
4+
5+ class SomeClassUsing {}
6+
7+ class UsingModule {}
You can’t perform that action at this time.
0 commit comments