public static void setupEditor(@NotNull PsiCodeBlock body, @NotNull ModPsiUpdater updater) {
    PsiElement l = PsiTreeUtil.skipWhitespacesForward(body.getLBrace());
    PsiElement r = PsiTreeUtil.skipWhitespacesBackward(body.getRBrace());
    if (l != null && r != null) {
      int start = l.getTextRange().getStartOffset();
      int end = r.getTextRange().getEndOffset();
      updater.moveCaretTo(Math.max(start, end));
      if (end < start) {
        updater.moveCaretTo(end + 1);
        CodeStyleManager styleManager = CodeStyleManager.getInstance(body.getProject());
        PsiFile containingFile = body.getContainingFile();
        final String lineIndent = Objects.requireNonNullElse(styleManager.getLineIndent(containingFile, end), "");
        PsiDocumentManager manager = PsiDocumentManager.getInstance(body.getProject());
        Document document = body.getContainingFile().getViewProvider().getDocument();
        manager.doPostponedOperationsAndUnblockDocument(document);
        document.insertString(updater.getCaretOffset(), lineIndent + "\n");
        updater.moveCaretTo(updater.getCaretOffset() + lineIndent.length());
      }
      else {
        //correct position caret for groovy and java methods
        if (body.getParent() instanceof PsiMethod) {
          final PsiGenerationInfo<PsiMethod> info = OverrideImplementUtil.createGenerationInfo((PsiMethod)body.getParent());
          info.positionCaret(updater, true);
        }
      }
    }
  }
public static void setupEditor(@NotNull PsiCodeBlock body, @NotNull ModPsiUpdater updater)