Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove_trailing_whitespace is removing one trailing newline at each run #322

Open
tardypad opened this issue Mar 4, 2024 · 1 comment
Open

Comments

@tardypad
Copy link

tardypad commented Mar 4, 2024

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.

@cmpadden
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants