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

Provide a way to stop trim_trailing_whitespace option to modify entire file on save #94

Open
nbenitez opened this issue Jan 8, 2022 · 1 comment

Comments

@nbenitez
Copy link

nbenitez commented Jan 8, 2022

When you contribute to open source projects you are required to submit patches or PR with just the code changes for the issue you're trying to fix, but, if the .editorconfig file has trim_trailing_whitespace: true (like here) then even if you just change one line code and save, then the file will have lot of whitespace changes due to the mentioned option.

EditorConfig website docs for trim_trailing_whitespace does not mention that the option should affect ALL the file on save, I think it's less intrusive to just remove the trailing whitespace from the lines of code that you're editing (not to all the file on save).

Well, I understand that this option has been working like that for a while, so in order to not change behaviour for existing users, I propose to add a new preference option like eg. trim_trailing_whitespace_not_on_save: true which will disable the undesirable effect.

Check out this StackOverflow question as an example of how this is currently affecting users:
https://stackoverflow.com/questions/43343211/sublime-text-3-is-automatically-converting-spaces-to-tabs-on-save-regardless-of/

@jpcirrus
Copy link

According to the EditorConfig specification the description for trim_trailing_whitespace is: "Set to true to remove all whitespace characters preceding newline characters in the file and false to ensure it doesn’t.", which refers to the file not modified lines. So this package is doing the right thing according to the spec. Fortunately, since Sublime Text build 4050, released on 2019-11-13, there is a new setting trim_only_modified_white_space with the default value of true which does what you (and I) want. Prior to that I was using the TrailingSpaces package which could be configured to do the same thing.

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