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

Enforce settings for newly created -> saved files #19

Merged
merged 1 commit into from
Feb 15, 2014

Conversation

xaka
Copy link
Contributor

@xaka xaka commented Jan 21, 2014

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
Copy link

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

@sindresorhus
Copy link
Owner

@xaka can you add a description to your PR?

@xaka
Copy link
Contributor Author

xaka commented Feb 15, 2014

@sindresorhus done!

@sindresorhus
Copy link
Owner

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.
@xaka
Copy link
Contributor Author

xaka commented Feb 15, 2014

@sindresorhus done!

sindresorhus added a commit that referenced this pull request Feb 15, 2014
Enforce settings for newly created -> saved files
@sindresorhus sindresorhus merged commit b9431c3 into sindresorhus:master Feb 15, 2014
@sindresorhus
Copy link
Owner

Nice work! :D

@kevinSuttle
Copy link

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

@xaka
Copy link
Contributor Author

xaka commented Feb 16, 2014

@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
Copy link

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

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

Successfully merging this pull request may close these issues.

3 participants