sindresorhus / editorconfig-sublime

Sublime Text plugin for EditorConfig - Helps developers maintain consistent coding styles between different editors
MIT License
1.77k stars 108 forks source link

Force whitespace pre-save #47

Closed kalebtrotter closed 9 years ago

kalebtrotter commented 9 years ago

Removing the spaces == True and spaces == False check in the apply_pre_save method simply tells Sublime to enforce the tabs/spaces style throughout the document on save, as requested in #33

sindresorhus commented 9 years ago

It's like it is for a reason. git blame is a good tool to figure out why code is like it is.

https://github.com/sindresorhus/editorconfig-sublime/commit/0a296cccb6d23736aa8b6e9790279a11c1546514

kalebtrotter commented 9 years ago

Thanks for clarifying! Sorry for not doing my research -- definitely should have looked into why the check was present.

I've noticed those scroll position changes when using translate_tabs_to_spaces, but in my experience (SublimeText 3 on Mac), it didn't move by much. In my mind, the benefits of the change far outweigh what has been a pretty trivial scroll position change (again, that's just my experience and the experience of a few co-workers).

Totally understand that the scroll issue may be a more significant/annoying problem for other users. Happy to have this request closed if the solution isn't acceptable, thanks much for considering.

sindresorhus commented 9 years ago

I'm honestly not sure. I'm leaning towards merging this, but there was a lot of user complaining about the "jump" https://github.com/sindresorhus/editorconfig-sublime/issues/27. Too bad Sublime Text isn't open source so we could fix the actual bug...

In my mind, the benefits of the change far outweigh what has been a pretty trivial scroll position change

Do you know if it's possible to manually set the scroll position? If so we could maybe come up with a hack that prevents the jump.

kalebtrotter commented 9 years ago

Sorry about the lengthy hiatus on this, went on a long vacation and have been catching up with work since. I like manually setting scroll position as a work-around, and I'll keep exploring that option. Thanks for the reply!

kalebtrotter commented 9 years ago

@sindresorhus Finally got some time to work on this, and it was super straightforward. Manually setting the viewport worked like a charm.

brismuth commented 9 years ago

I've been using this branch for a bit and I haven't had any issues. Great fix @kalebtrotter.

kalebtrotter commented 9 years ago

@brismuth Thanks! Glad to hear it!

sindresorhus commented 9 years ago

@kalebtrotter Nice! Thanks :)

kalebtrotter commented 9 years ago

Thank you! Glad I could help out even a little bit. Cheers!

sindresorhus commented 9 years ago

:beers: Cheers!

And if you're looking for more challenges I could always use some help with https://github.com/sindresorhus/editorconfig-sublime/issues/44 ;)