Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Provide a service allowing packages to suppress removal of whitespace #160

Open
1 task done
segevfiner opened this issue Jul 20, 2017 · 0 comments
Open
1 task done

Comments

@segevfiner
Copy link

segevfiner commented Jul 20, 2017

Prerequisites

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

segevfiner added a commit to segevfiner/whitespace that referenced this issue Jul 20, 2017
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 themself.

Fixes atom#160
segevfiner added a commit to segevfiner/whitespace that referenced this issue Jul 20, 2017
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 them self.

Fixes atom#160
segevfiner added a commit to segevfiner/whitespace that referenced this issue Jul 20, 2017
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.

Fixes atom#160
segevfiner added a commit to segevfiner/whitespace that referenced this issue Jul 21, 2017
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.

Fixes atom#160
segevfiner added a commit to segevfiner/whitespace that referenced this issue Jul 21, 2017
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.

Fixes atom#160
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants