atom / whitespace

Atom whitespace package
MIT License
94 stars 61 forks source link

Trailing spaces removed from md files despite options set correctly #156

Closed Moini closed 7 years ago

Moini commented 7 years ago

Prerequisites

Description

With the package enabled, trailing whitespace is being removed in markdown files. In the package's settings, the option 'Keep Markdown Linebreak Whitespace' is enabled. I've even added

  '.text.md':
      whitespace:
        removeTrailingWhitespace: false

to the config file, but it doesn't help.

Steps to Reproduce

  1. Enable whitespace package
  2. Edit or create an .md file, to contain additional space characters at end of line. Move cursor away from that line
  3. Save
  4. Spaces are gone, rendered Markdown looks wrong.
  5. Disable whitespace package
  6. Repeat 2. and 3.
  7. Spaces are kept.

Expected behavior: Spaces are kept.

Actual behavior: Spaces are lost.

Reproduces how often: On every save of Markdown file.

Versions

Atom : 1.17.2 Electron: 1.3.15 Chrome : 52.0.2743.82 Node : 6.5.0 apm 1.17.0 npm 3.10.5 node 6.9.5 x64 python 2.7.12 git 2.7.4 whitespace 0.36.2 Linux Mint 18.1 Serena

thomasjo commented 7 years ago

https://github.com/burodepeper/language-markdown/blob/master/FAQ.md#trailing-whitespace-is-automatically-removed-but-i-dont-want-that

Moini commented 7 years ago

Sorry, @thomasjo . If you have read my report closely, then you will have seen that I have done that, and it didn't work. And if I disable this package, the whitespace is not removed.

So if you still think your judgement is correct, then please explain why and how that can be (or what you suspect that I'm doing wrong).

Update: Found it out. Thanks. (although a sentence instead of a link would have been a bit more helpful)

Moini commented 7 years ago

What I don't understand is: why does the whitespace package have that option if it doesn't work? Shouldn't the option add that to the config somehow? I'm still confused.

thomasjo commented 7 years ago

Read the FAQ properly — it clearly shows the key .md.text, but according to your own description above you're using .text.md, which is incorrect.

winstliu commented 7 years ago

From previous experience, I don't think the order matters (and Atom actually will re-arrange it for you). However, @Moini can you confirm that trailing spaces are removed even in safe mode (atom --safe)?

thomasjo commented 7 years ago

From previous experience, I don't think the order matters

That is news to me, but good news I guess 🎱

However, @Moini can you confirm that trailing spaces are removed even in safe mode (atom --safe)?

From the grammar scope the only logical conclusion is that he's using the language-markdown package, so it likely won't be all that useful to verify this in safe mode, since that setting will have zero effect because then any markdown file will then be .gfm.source instead of .md.text.
Unless you're thinking they might be suffering from some unknown bug in this package?

Moini commented 7 years ago

The order mattered.

I had copied the '.text.md' from another settings file for another package, where the order (which is wrong for whitespace) worked.... (snippets package settings).

The whitespace package removes trailing whitespace in safe mode for me, when the config file does not contain the above mentioned fix (with the correct order, that is). I expected it wouldn't, when the checkbox in its settings is checked.

It's 'she' btw. ;-) - and yes, I've got the language-markdown package installed. So this package interferes by setting a different 'file type'? But how does the fix work, then? I didn't write .gfm.source.

Where would be the best place to fix this (so no user action is required)?