private static @NotNull PsiElement formatElement(@NotNull PsiElement element,
                                                  @NotNull TextRange range,
                                                  boolean canChangeWhiteSpacesOnly,
                                                  boolean forceAsync) {
    PsiFile file = element.getContainingFile();
    boolean isFullRange = range.equals(file.getTextRange());
    PsiElement contextElement = element;
    FormattingService mainService = findService(element.getContainingFile(), true, isFullRange);
    if (isFullRange) {
      for (FormattingService service : getChainedServices(mainService)) {
        contextElement = formatElement(service, contextElement, range, canChangeWhiteSpacesOnly, forceAsync);
      }
      return contextElement;
    }
    else {
      return formatElement(mainService, element, range, canChangeWhiteSpacesOnly, forceAsync);
    }
  }
private static @NotNull PsiElement formatElement(@NotNull PsiElement element,
                                                  @NotNull TextRange range,
                                                  boolean canChangeWhiteSpacesOnly,
                                                  boolean forceAsync)