@Override
  protected @Nullable FormattingTask createFormattingTask(@NotNull AsyncFormattingRequest request) {
    FormattingContext formattingContext = request.getContext();
    Project project = formattingContext.getProject();
    String shFmtExecutable = ShSettings.getShfmtPath();
    if (!ShShfmtFormatterUtil.isValidPath(shFmtExecutable)) {
      return null;
    }

    ShShfmtFormatterUtil.checkShfmtForUpdate(project);
    String interpreter = ShShebangParserUtil.getInterpreter((ShFile)formattingContext.getContainingFile(), KNOWN_SHELLS, "bash");

    CodeStyleSettings settings = formattingContext.getCodeStyleSettings();
    ShCodeStyleSettings shSettings = settings.getCustomSettings(ShCodeStyleSettings.class);
    if (ShSettings.I_DO_MIND_SUPPLIER.get().equals(shFmtExecutable)) return null;

    File ioFile = request.getIOFile();
    if (ioFile == null) return null;

    @NonNls
    List<String> params = new SmartList<>();
    params.add("-ln=" + interpreter);
    if (!settings.getIndentOptions(ShFileType.INSTANCE).USE_TAB_CHARACTER) {
      int tabSize = settings.getIndentOptions(ShFileType.INSTANCE).INDENT_SIZE;
      params.add("-i=" + tabSize);
    }
    if (shSettings.BINARY_OPS_START_LINE) {
      params.add("-bn");
    }
    if (shSettings.SWITCH_CASES_INDENTED) {
      params.add("-ci");
    }
    if (shSettings.REDIRECT_FOLLOWED_BY_SPACE) {
      params.add("-sr");
    }
    if (shSettings.KEEP_COLUMN_ALIGNMENT_PADDING) {
      params.add("-kp");
    }
    if (shSettings.MINIFY_PROGRAM) {
      params.add("-mn");
    }
    params.add(ioFile.getPath());

    try {
      GeneralCommandLine commandLine = new GeneralCommandLine()
        .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE)
        .withExePath(shFmtExecutable)
        .withParameters(params);

      OSProcessHandler handler = new OSProcessHandler(commandLine.withCharset(StandardCharsets.UTF_8));
      return new FormattingTask() {
        @Override
        public void run() {
          handler.addProcessListener(new CapturingProcessAdapter() {
            @Override
            public void processTerminated(@NotNull ProcessEvent event) {
              int exitCode = event.getExitCode();
              if (exitCode == 0) {
                request.onTextReady(getOutput().getStdout());
              }
              else {
                request.onError(message("sh.shell.script"), getOutput().getStderr());
              }
            }
          });
          handler.startNotify();
        }

        @Override
        public boolean cancel() {
          handler.destroyProcess();
          return true;
        }

        @Override
        public boolean isRunUnderProgress() {
          return true;
        }
      };
    }
    catch (ExecutionException e) {
      request.onError(message("sh.shell.script"), e.getMessage());
      return null;
    }
  }
@Override
  protected @Nullable FormattingTask createFormattingTask(@NotNull AsyncFormattingRequest request)