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

incompatibility with trim_trailing_white_space_on_save #32

Open
akvadrako opened this issue Jun 22, 2016 · 1 comment
Open

incompatibility with trim_trailing_white_space_on_save #32

akvadrako opened this issue Jun 22, 2016 · 1 comment

Comments

@akvadrako
Copy link

I have trim_trailing_white_space_on_save = true in my user settings. This means that every time autosave triggers, if I had just typed a space, it gets removed.

It would be nice if autosave somehow didn't do that.

@scholer
Copy link
Contributor

scholer commented Jun 28, 2016

Yeah, I can see that might be annoying. Although what we really need is just to not trim the current line; I would like to trim other lines that I am done working on. Otherwise the auto-saved version would be too different from the "ctrl+s" manually saved file. Other editors (e.g. Komodo Edit) has an option to not trim the current line when trimming trailing white spaces.

As a short term solution, you can increase the auto-save delay, but I can see that's not really an optimal solution. A better solution might be to have auto-save manually trim the current view, but exclude the current line. AFAIK, it is not possible to alter the behaviour of Sublime Text when saving, i.e. if you have trim_trailing_white_space_on_save enabled, then sublime text will trim trailing white spaces, just like when you manually save with ctrl+s. And there is nothing we can do from the plugin side to change that. Other than, perhaps, toggling trim_trailing_white_space_on_save off before saving, and on again after saving.

This does seem a bit like another example where it would be nice to customize how the API save command is invoked. We have a similar case where we don't want Sublime Text to hide word completions when saving (PR #27). In other words, it would be nice to be able to invoke save with something like: view.run_command("save", {"trim_trailing_white_spaces": False, "hide_autocomplete_popup": False})) -- where the second argument is a dict to customize the behaviour of the save command, in this case not hiding autocomplete popups and not trimming trailing white spaces.

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