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

Enforce settings for newly created -> saved files #19

Closed xaka closed 10 years ago

xaka commented 10 years ago

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.

kevinSuttle commented 10 years ago

I'm curious in general about how to manually enforce editorconfig rules within Sublime by using this plugin. Does this PR solve that?

sindresorhus commented 10 years ago

@xaka can you add a description to your PR?

xaka commented 10 years ago

@sindresorhus done!

sindresorhus commented 10 years ago

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?

xaka commented 10 years ago

@sindresorhus done!

sindresorhus commented 10 years ago

Nice work! :D

kevinSuttle commented 10 years ago

Awesome! Thanks! Is there a UI, or prefs file for this?

xaka commented 10 years ago

@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?

kevinSuttle commented 10 years ago

@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.

screenshot 2014-02-15 23 58 11

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.