sindresorhus / atom-editorconfig

Helps developers maintain consistent coding styles between different editors

Home Page:https://atom.io/packages/editorconfig

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`trim_trailing_whitespace` property

sindresorhus opened this issue · comments

http://editorconfig.org

trim_trailing_whitespace: set to true to remove any whitespace characters preceding newline characters and false to ensure it doesn't.

The bundled whitespace plugin has an option for this called removeTrailingWhitespace

I can change it with: atom.config.set('whitespace.removeTrailingWhitespace', true);, but that changes it globally and we definitely don't want that. From what I can figure out from the docs it isn't possible to override config on a per buffer basis like you can with Sublime.

In other words, Atom bundles a package called "Whitespace" which conflicts with editorconfig and will (by default) remove trailing whitespace even if your .editorconfig file specifies not to remove it (for example with jade files). As a work around, you can open Atom preferences for the Whitespace package and disable the Whitespace package.

In the VS Code extension we have to do it manually because there just isn't an option to do this with core methods. Same goes for insert_final_newline.

https://github.com/editorconfig/editorconfig-vscode/tree/master/src/transformations

As already mentioned, this functionality is implemented by the atom-whitespace-package.

As soon as i have found out how to interact nicely with the whitespace-package, we're going on to implement that functionality.

I'll try to find a solution with the package-maintainer. ☕