mhartington/formatter.nvim

remove_trailing_whitespace is removing one trailing newline at each run

tardypad opened this issue · 1 comments

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.

I've confirmed that I experience the same behavior. ➕