boolean (@NotNull GroovyPsiElement element) { final GrWhileStatement whileStatement = PsiTreeUtil.getParentOfType(element, GrWhileStatement.class); if (whileStatement == null) { return false; } final GrStatement body = whileStatement.getBody(); return PsiTreeUtil.isAncestor(body, element, true); }