boolean (@NotNull PsiElement scope) { return WolfTheProblemSolver.getInstance(scope.getProject()).hasProblemFilesBeneath(virtualFile -> { if (scope instanceof PsiDirectory) { final PsiDirectory directory = (PsiDirectory)scope; if (!VfsUtilCore.isAncestor(directory.getVirtualFile(), virtualFile, false)) return false; return ModuleUtilCore.findModuleForFile(virtualFile, scope.getProject()) == ModuleUtilCore.findModuleForPsiElement(scope); } else if (scope instanceof PsiDirectoryContainer) { // TODO: remove. It doesn't look like we'll have packages in navbar ever again final PsiDirectory[] psiDirectories = ((PsiDirectoryContainer)scope).getDirectories(); for (PsiDirectory directory : psiDirectories) { if (VfsUtilCore.isAncestor(directory.getVirtualFile(), virtualFile, false)) { return true; } } } return false; }); }