-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Enforce settings for newly created -> saved files #19
Conversation
I'm curious in general about how to manually enforce editorconfig rules within Sublime by using this plugin. Does this PR solve that? |
@xaka can you add a description to your PR? |
@sindresorhus done! |
Makes sense. Should probably use the same marker as https://github.com/sindresorhus/editorconfig-sublime/pull/21/files#diff-f090b8cb644d551eaa20693ecc654a5dR29 Mind fixing the merge conflict? |
When users create a new file, it doesn't have a name yet so the plugin doesn't know which settings it should apply. Later, when users save the new file and assign a name to it, they expect the plugin to apply the settings from their `.editorconfig` file according to the new file name and it doesn't happen so they have to close the file and open it again. Very annoying. This PR fixes the problem by applying the settings via `on_post_save` hook. To make sure we don't do that for every save operation (as it might lead to performance degradation), we mark the files and skip them later.
@sindresorhus done! |
Enforce settings for newly created -> saved files
Nice work! :D |
Awesome! Thanks! Is there a UI, or prefs file for this? |
@kevinSuttle I'm a little bit confused, but what exactly are you trying to do and why it's related to this PR? What kind of UI are you looking for? |
@xaka I'm trying to "Enforce settings for newly created -> saved files" from the Sublime package manager UI or Package settings menu. See an example of the Trailing Spaces plugin. With this plugin, the user has no way to know what's happening and when, let alone how to control it. Just looking for a preferences file or some sort of UI message/controls. |
When users create a new file, it doesn't have a name yet so the plugin doesn't know which settings it should apply. Later, when users save the new file and assign a name to it, they expect the plugin to apply the settings from their
.editorconfig
file according to the new file name and it doesn't happen so they have to close the file and open it again. Very annoying. This PR fixes the problem by applying the settings viaon_post_save
hook. To make sure we don't do that for every save operation (as it might lead to performance degradation), we mark the files and skip them later.