<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="205708" data-post-id="205708">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="thiagomajesk" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thiagomajesk/120/31904_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  thiagomajesk
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>There is no “leading” whitespace involved in this problem. The problem is just that vscode removes two <em>trailing</em> spaces. It does not remove any leading space otherwise your code would not be indented.</p>
</blockquote>
<p>The current option called <code>files.trimTrailingWhitespace</code>, also trims ““leading”” whitespaces in files, which is the root cause of the problem. Because of that, you can’t have one <strong>or</strong> the other.</p>
<p>So, for this scenario, we still want to be able to trim leading whitespace in our files without affecting elixir markdown documentation.</p>
<p>The problem is not caused directly because of leading whitespace and this was never (in my perception) even suggested. It’s caused because of trailing whitespace being removed as well as leading whitespaces - because you only have one option to configure it and it does both.</p>
<hr>
<p><strong>Update:</strong></p>
<p>To illustrate a little more:</p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/e/5/e553085a1cc1cf3ac4be8a68cc71c789d5958135.png" data-download-href="https://forum.elixirforum.com/uploads/default/e553085a1cc1cf3ac4be8a68cc71c789d5958135" title="image" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/original/3X/e/5/e553085a1cc1cf3ac4be8a68cc71c789d5958135.png" alt="image" data-base62-sha1="wIHeIdXOtW1VO32S4fvLljEJSol" width="676" height="230"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">676×230 9.09 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/3/b/3bb584a47182ee97e532b0b8dc9a7231a85f2479.png" data-download-href="https://forum.elixirforum.com/uploads/default/3bb584a47182ee97e532b0b8dc9a7231a85f2479" title="image" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/original/3X/3/b/3bb584a47182ee97e532b0b8dc9a7231a85f2479.png" alt="image" data-base62-sha1="8wd4r630RJfjCwUi0FsjxrS5oz7" width="485" height="228"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">485×228 8.32 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>You can clearly see that the current behavior considers all whitespace as ““trailing”” (hence the option). The editor doesn’t make the distinction between whitespace that goes before (leading) or after (trailing) content. Indentation would still be preserved, just not for “blank” lines.</p>
<p>Another example:</p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/d/e/dedc5e94ce69a8f5b5161fa2a61e586b9227434e.png" data-download-href="https://forum.elixirforum.com/uploads/default/dedc5e94ce69a8f5b5161fa2a61e586b9227434e" title="image" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/original/3X/d/e/dedc5e94ce69a8f5b5161fa2a61e586b9227434e.png" alt="image" data-base62-sha1="vNw8xNQ9nxIjIOPUPBJnBUkoY0u" width="667" height="362"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">667×362 14.8 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/2/f/2fe4eb91daff50ab9ab697534b6d62b97d62f5f4.png" data-download-href="https://forum.elixirforum.com/uploads/default/2fe4eb91daff50ab9ab697534b6d62b97d62f5f4" title="image" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/original/3X/2/f/2fe4eb91daff50ab9ab697534b6d62b97d62f5f4.png" alt="image" data-base62-sha1="6PGTP0iPQIx0vc2FgRhDwHb0Bve" width="510" height="360"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">510×360 13.9 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>If whitespace were by default considered leading whitespace until there’s content, this file could be formatted without losing the markdown line breaks at the end. It would also be easier to remove blank lines after this.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="205708" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-file-formatting-with-vscode-removing-whitespaces-and-documentation/37966/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-205708" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="205708"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="205730" data-post-id="205730">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lud" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lud/120/14382_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lud
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think there is some confusion about the “leading” word. The only “leading” whitespace on your 3rd image is the one that is still there on the 4th image.</p>
<p>Whitespace is considered “per line”. The editor doesn’t care about what the code means, it just removes whitespace at the end of the line, except for the line break.</p>
<p>On line 1 there is none leading or trailing.<br>
On line 2, there are only spaces, and no content. The editors considers this space to be at the end of the line (trailing), and removes it.<br>
On line 3 there are two leading spaces before <a class="mention" href="/u/doc" rel="nofollow">@doc</a>, and they are still there after the cleanup.<br>
On line 4, there are two leading spaces too, before “Some”, and they are still there. After the content (after the word “here”) there is trailing whitespace, and it gets removed.<br>
And so on.</p>
<p>So no, the editor does not consider all whistespace as trailing. It does not remove leading whitespace.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="205730" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-file-formatting-with-vscode-removing-whitespaces-and-documentation/37966/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-205730" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="205730"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="205750" data-post-id="205750">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="thiagomajesk" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thiagomajesk/120/31904_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  thiagomajesk
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks to everyone that contributed, we reached our goal!</p>
<p>While we are here jousting about semantics, there are at least 27 people (so far) that shared our pain, regardless of the “proposed” solution.</p>
<p>I hope this gets picked up and the team back at Microsoft can propose a nice solution that helps us solve this issue. So, thanks to you all!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="205750" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-file-formatting-with-vscode-removing-whitespaces-and-documentation/37966/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-205750" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="205750"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>