@Override
  public @Nullable FormattingProgressCallback createProgressCallback(@NotNull Project project,
                                                                     @NotNull PsiFile file,
                                                                     @NotNull Document document) {
    if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
      return new FormattingProgressTask(project, file, document);
    }
    return null;
  }
@Override
  public @Nullable FormattingProgressCallback createProgressCallback(@NotNull Project project,
                                                                     @NotNull PsiFile file,
                                                                     @NotNull Document document)