void (@NotNull PsiFile file, @NotNull FormatTextRanges ranges, boolean canChangeWhiteSpaceOnly) { boolean isFullRange = ranges.getRanges().size() == 1 && ranges.getRanges().get(0).getTextRange().equals(file.getTextRange()); FormattingService mainService = findService(file, true, isFullRange); if (isFullRange) { for (FormattingService service : getChainedServices(mainService)) { service.formatRanges(file, ranges, canChangeWhiteSpaceOnly, false); } } else { // Range formatting can use only one service since the ranges become invalid after reformat. mainService.formatRanges(file, ranges, canChangeWhiteSpaceOnly, false); } }