void (@NotNull Editor editor, @NotNull GroovySmartEnterProcessor processor, @NotNull PsiElement psiElement) { if (!(psiElement instanceof GrWhileStatement whileStatement)) return; final Document doc = editor.getDocument(); PsiElement body = whileStatement.getBody(); if (body instanceof GrBlockStatement) return; if (body != null && GrForBodyFixer.startLine(editor.getDocument(), body) == GrForBodyFixer.startLine(editor.getDocument(), whileStatement) && whileStatement.getCondition() != null) return; final PsiElement rParenth = whileStatement.getRParenth(); assert rParenth != null; doc.insertString(rParenth.getTextRange().getEndOffset(), "{}"); }