-
Notifications
You must be signed in to change notification settings - Fork 57
Provide a service allowing packages to suppress removal of whitespace #160
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
Some packages like editorconfig want to manage white space on their own, but only under certain cases (e.g. You have an .editorconfig file that sets some property that is also implemented by whitespace). For editorconfig to work correctly today, you have to disable whitespace so that it doesn't conflict with it, and editorconfig even takes measures to warn you about this.
Disabling whitespace is less than ideal since not every project uses editrorconfig and you want it enabled for such projects, maybe you even want it enabled for projects using editorconfig so that if they don't specify settings for the stuff whitespace implements than the defaults from whitespace apply.
If whitespace would provides a service that allows suppressing the removal of trailing whitespace and/or ensuring a trailing new line it would allow editorconfig to work even with whitespace enabled (Once implemented by editorconfig of course).
I imagine it something like this:
function provideWhiteSpaceSuppressor() {
return {
shouldSuppressRemoveTrailingWhitespace(editor) {
return managingRemoveTrailingWhitespace()
}
shouldSuppressEnsureSingleTrailingNewline(editor) {
return managingEnsureSingleTrailingNewline()
}
}
}With plenty of bike shedding of course 😝
I'm opening this issue as a suggestion. It's up for discussion as to whether this is the best way to solve this. Maybe there are better ways to suppress the whitespace package temporarily that I (and probably the developers of the editorconfig package) don't know of.
Versions
Atom : 1.18.0
Electron: 1.3.15
Chrome : 52.0.2743.82
Node : 6.5.0
apm 1.18.1
npm 3.10.10
node 6.9.5 x64
python 2.7.13
git 2.13.3.windows.1
visual studio 2015
Windows 10.0.15063 x64
Additional Information
sindresorhus/atom-editorconfig#105
sindresorhus/atom-editorconfig#159