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

[feature request] trim only modified lines #22

Open
zhengpd opened this issue May 9, 2024 · 3 comments · May be fixed by #23
Open

[feature request] trim only modified lines #22

zhengpd opened this issue May 9, 2024 · 3 comments · May be fixed by #23

Comments

@zhengpd
Copy link
Contributor

zhengpd commented May 9, 2024

It would be nice to allow trimming only modified lines. Trimming whole file creates some unwanted diff changes in old project files. vim-better-whitespaces has an option strip_only_modified_lines for this use case.

@jan-grimo jan-grimo linked a pull request May 24, 2024 that will close this issue
@cappyzawa
Copy link
Owner

@zhengpd

Thanks for your request.

While I understand that this feature trims only modified lines, I'm not sure how this benefits users. Specifically, having different styles within a file might not be ideal. Could you explain why this might be useful?

If you feel that unnecessary spaces or line breaks are an issue, it would be better to apply formatting to the entire file, even to unmodified sections.

@jan-grimo
Copy link

I wholeheartedly agree with you that applying formatting to the entire file once would be best.

However, an organization may decide not to apply standardized formatting, or reject a one-time fix to all of its whitespace code problems, for the sole reason of not "polluting" when a line was last changed. For developers in such a situation that do not want to unintentionally contribute to the already existing whitespace issues, it is nice to be sure that at least the new changes they make do not contain whitespace problems.

@zhengpd
Copy link
Contributor Author

zhengpd commented Nov 16, 2024

@cappyzawa

I also agree that formatting the whole file would be best.

There was one time that a bug was traced back on me by doing git blame, and I had to explain to my project leader that I only changed whitespace and am not the one who really introduced the bug. So in some situation I prefer trim only modified lines to ensure only what I really code don't contain trailing whitespaces.

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

Successfully merging a pull request may close this issue.

3 participants