This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
[WIP] Implement the whitespace.suppressor service #161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No specs for now. Before I invest more time into this, I prefer to get some feedback if this is even the right way to go. Maybe even from someone that maintains the editorconfig package which is where this issue comes from.
Requirements
Description of the Change
This service allows packages to suppress the automatic transformations of the whitespace package. This is useful for packages that implement or want to control such functionality themselves. A package that implements this service will be called before whitespace modifies the whitespace in a file automatically and can decide to suppress the transformation. An example of such a service is below.
Alternate Designs
Having the user manually disable the whitespace package or change it's settings to work with packages that conflict with it is not convenient. And disabling whitespace entirely also removes the access to it's commands. Having other packages disable/enable the entire whitespace package automatically is quite an hack and probably won't work that well in practice, and will still remove the access to the whitespace package commands.
Their might be a different/better API for such a service, or maybe something different than a service that is appropriate.
For example wouldn't it feel nicer if all such whitespace, and similar settings, were something that is set per buffer (Defaulting to a language scope setting) and a package like editorconfig only had to modify such settings to enable/disable or disable and implement itself. I think some settings that are managed by core Atom and used by editorconfig are like this. I'm not familiar enough with the code base to say whether this is even a plausible idea. Just a drive by contributor here. And that's probably a much larger change anyhow...
Benefits
A package like editorconfig can implement the service and suppress the operation of the whitespace package automatically when it's managing the relevant transformation and leave it active otherwise, so the whitespace package settings take effect when unset. For example:
And in
package.json
:Possible Drawbacks
Not exactly sure on the names I choose here. It's a yet another semi-internal API for solving a specific conflict with packages that want to manage this themselves and I'm not entirely sure about the design of this.
Applicable Issues
Fixes #160