atom / whitespace

Atom whitespace package
MIT License
94 stars 61 forks source link

Trailing whitespace removed in multiline strings #170

Open gregreen opened 6 years ago

gregreen commented 6 years ago

Atom removes trailing whitespace, even in the middle of multiline strings. For example, the following Python code is mangled by atom:

s = """Hello, 
world!"""

Note the space after "Hello," If this whitespace is important, this is a problem. I've run into this problem when trying to write documentation with pygments, which styles the strings ">>>" and ">>> " differently.

I understand that the Atom team considers trailing whitespace to be poor coding style, but it should be preserved inside strings, where removing it can alter program functionality.

Cohen-Carlisle commented 6 years ago

I'd love to see this enhancement as an option to enable/disable specifically inside strings. I had to turn off trimming trailing whitespace while working on this kata, but that turned if off globally which was annoying outside the strings.