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

Amp silently removes trailing spaces at end of line #217

Open
multinormal opened this issue Apr 14, 2021 · 3 comments
Open

Amp silently removes trailing spaces at end of line #217

multinormal opened this issue Apr 14, 2021 · 3 comments

Comments

@multinormal
Copy link

multinormal commented Apr 14, 2021

Editing and then saving a file containing lines that end with a space character results in a file where some or all such trailing characters have been removed, even on lines that have not been edited. (I have not had time to explore this behavior in detail, so I do not know if all such lines are altered, if only spaces or other whitespace characters are altered, or if only visited lines are affected.)

If this is correct behavior rather than a bug, this seems overly opinionated — it's not too hard to imagine this behavior introducing difficult-to-diagnose bugs (given spaces are generally invisible).

@jmacdonald
Copy link
Owner

"Overly opinionated" is kind of the tag line for amp. 😄 Trailing whitespace has always been an anti-pattern in my experience, and the surprise of unrelated changes can always be managed by using partial staging in git. Ensuring a trailing newline is a similar (and admittedly more common) behaviour.

That said, I wouldn't be opposed to making this configurable. The behaviour for both of these is wrapped up in the save command.

@x4e
Copy link

x4e commented Apr 17, 2021

I believe #116 allows you to add trim_trailing_whitespace option not only in .editorconfig files but also in your amp configuration.

@soloturn
Copy link

soloturn commented Jul 17, 2021

@jmacdonald , editorconfig is nice to solve this issue. two trailing whitespaces in markdown are the same as <br> so removing them breaks markdown, oother example see here:
microsoft/vscode#1679

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

4 participants