Skip to content

remove_trailing_whitespace is removing one trailing newline at each run #322

@tardypad

Description

@tardypad

Which configuration?
Type: builtin
Filetype: none
Formatter: any remove_trailing_whitespace

Configuration:

require("formatter").setup {
  filetype = {
    ["*"] = {
      function()
        return require("formatter.filetypes.any").remove_trailing_whitespace()
      end
    }
  }
}

Expected behavior

yo


in hex 796f 0a0a 0a

Should be unchanged by the formatter

Actual behaviour

yo

in hex 796f 0a0a

if you have another run of the formatter, then one more newline is removed

yo

in hex 796f 0a

From here on new runs don't change anything

Additional context

I tried but couldn't find the reason after a quick check of the code.
I feel this is an issue coming from the way the data from stdin is ingested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions