PsiElement (@NotNull PsiElement element) { PsiElement scope = PsiTreeUtil.getParentOfType(element, PsiMethod.class, PsiLoopStatement.class); if (scope instanceof PsiLoopStatement) scope = ((PsiLoopStatement)scope).getBody(); return scope; }