Module (@NotNull PsiElement element, @NotNull Project project) { PsiFile containingFile = element.getContainingFile(); if (containingFile != null) { VirtualFile virtualFile = containingFile.getVirtualFile(); if (virtualFile != null) { return ProjectFileIndex.getInstance(project).getModuleForFile(virtualFile); } } return null; }