Find all files of some kind inside workspace
Hello guys,
It seems element.getProject represents only the module related to this element.
For example, this piece of code finds only files inside the module:
val confFiles = getFilesByType(project, TypeSafeConfFileType())
def getFilesByType(project: Project, fileType: LanguageFileType) = { val files = FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, fileType, GlobalSearchScope.allScope(project)).asScala files.map(f => PsiManager.getInstance(project).findFile(f)) }
But if I have multimodule project and all required files located in another module. I dont know how to find files from another module.
Does anyone know how to get references to another modules?
Please sign in to leave a comment.
The code you've posted does find the files in all modules of the current project, not just the current module.
Thanks, Dmitry. Seems that is because I had a bad configured project.