AA: expose library modules in the project structure

This commit is contained in:
Jinseong Jeon
2022-03-15 16:20:03 -07:00
committed by Ilya Kirillov
parent dcc349da0d
commit cbef3faae7
9 changed files with 136 additions and 12 deletions
@@ -13,6 +13,12 @@ public abstract class ProjectStructureProvider {
* For a given [PsiElement] get a [KtModule] to which [PsiElement] belongs.
*/
public abstract fun getKtModuleForKtElement(element: PsiElement): KtModule
/**
* Returns all [KtLibraryModule]s in this project.
*/
// TODO: We rather need a session or facade that maintains this information.
public abstract fun getKtLibraryModules(): Collection<KtLibraryModule>
}
/**
@@ -37,4 +43,4 @@ public inline fun <reified M : KtModule> PsiElement.getKtModuleOfType(project: P
* @param project [Project] which contains current [PsiElement]. `PsiElement.project` may be a heavy operation as it includes PSI tree traversal. So, when a [Project] is already available, it is better to pass it explicitly
*/
public inline fun <reified M : KtModule> PsiElement.getKtModuleOfTypeSafe(project: Project = this.project): M? =
getKtModule(project) as M?
getKtModule(project) as M?