private void doFormat(@NotNull Project project,
                        @NotNull Editor editor,
                        int howtoReformat,
                        int startOffset,
                        int endOffset,
                        int anchorColumn,
                        boolean indentBeforeReformat) {
    checkOffsets(editor.getDocument(), startOffset, endOffset);

    PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument());

    switch (howtoReformat) {
      case CodeInsightSettings.INDENT_BLOCK -> indentBlock(project, editor, startOffset, endOffset, anchorColumn);
      case CodeInsightSettings.INDENT_EACH_LINE -> indentEachLine(project, editor, startOffset, endOffset);
      case CodeInsightSettings.REFORMAT_BLOCK -> {
        final RangeMarker bounds = editor.getDocument().createRangeMarker(startOffset, endOffset);
        if (indentBeforeReformat) {
          indentEachLine(project, editor, startOffset, endOffset); // this is needed for example when inserting a comment before method
        }
        reformatRange(project, editor, bounds.getStartOffset(), bounds.getEndOffset());
        bounds.dispose();
      }
    }
  }
private void doFormat(@NotNull Project project,
                        @NotNull Editor editor,
                        int howtoReformat,
                        int startOffset,
                        int endOffset,
                        int anchorColumn,
                        boolean indentBeforeReformat)