boolean (PsiElement position) { PsiStatement statement = PsiTreeUtil.getParentOfType(position, PsiStatement.class); if (statement == null) return false; return statement instanceof PsiForStatement || statement.getParent() instanceof PsiForStatement && statement != ((PsiForStatement)statement.getParent()).getBody(); }