@Override
  public final void formatRanges(@NotNull PsiFile file,
                                 FormattingRangesInfo rangesInfo,
                                 boolean canChangeWhiteSpaceOnly,
                                 boolean quickFormat) {
    TextRange boundRange = ObjectUtils.notNull(rangesInfo.getBoundRange(), file.getTextRange());
    FormattingContext formattingContext = FormattingContext.create(file, boundRange, CodeStyle.getSettings(file), FormattingMode.REFORMAT);
    PsiDocumentManager documentManager = PsiDocumentManager.getInstance(file.getProject());
    Document document = documentManager.getDocument(file);
    if (document != null) {
      formatDocument(document, rangesInfo.getTextRanges(), formattingContext, canChangeWhiteSpaceOnly, quickFormat);
      documentManager.commitDocument(document);
    }
  }
@Override
  public final void formatRanges(@NotNull PsiFile file,
                                 FormattingRangesInfo rangesInfo,
                                 boolean canChangeWhiteSpaceOnly,
                                 boolean quickFormat)