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

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

@segevfiner

Description

@segevfiner

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions