I’ve been following along with the book and typing in the example application of Chapter 13.
My problem is in running the “mix text” from page 162. It always fails because the ‘atom-elixir-formatter’ v1.0.3 for the Atom editor does too good of a job and removes the trailing spaces of the text block used by the ‘assert’ of the “Output is correct” test.
Is there any way to tell the ‘atom-elixir-formatter’, from inside the file’s source code, to temporarily not remove trailing spaces? Or perhaps tell the formatter to skip a specific set of lines?
I know I could always temporarily disable the Atom plugin but, knowing me, I’ll forget to re-enable it when I’m done confirming that all tests pass.
For the time being, I just visually compared the left/right differences that the test discovered and ensured that it was only the trailing spaces that weren’t matching the left and right sides of the assert.
It doesn’t look like Atom is the culprit - Atom has no preference setting regarding the stripping, but having said that, I just created a test text file (.txt to ensure that the formatter plugin wouldn’t touch it) and it saved with my trailing spaces.
I think I’m going to report the problem to the plugin author - maybe its an oversight!?
IMHO: The formatter should not be touching text inside of a heredoc.
Interesting. I made sure to change VSCode settings to not strip trailing whitespace before testing. With the ElixirLS extension disabled whitespace would not be stripped. As soon as I enabled it, whitespace would be stripped. I assume that the extension is just using the Elixir formatter. I will test again using the formatter directly instead of the extension.
EDIT:@NobbZ is correct, the elixir formatter is not doing the whitespace stripping in my case. Although I had this setting in VSCode "files.trimTrailingWhitespace": false, the ElixirLS extension injected this into my settings:
// Configure editor settings to be overridden for [elixir] language.
Maybe the Elixir extension in atom is doing something similar?
No problem I learnt that ElixirLS is overwriting my settings for trailing whitespace and have opened a Github issue for this. Thanks to @NobbZ I also learnt about xxd which I think could be quite useful.