question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting to ignore whitespace-only lines

See original GitHub issue

VS Code currently removes all trailing whitespace including on whitespace only lines.

Consider the following JavaScript/Typescript snippet:

export default class Example {
    constructor() {
        console.log("called constructor");
    }
    
    doSomething() {
        console.log("I did something.");
    }
}

When I come back to this file, I expect to be able to move the cursor between the two methods and add a new one in between without having to hit the tab key, but after running the VS Code formatter, the whitespace on that line (ln. 5) is removed.

Atom supports this under an “Ignore Whitespace Only Lines” setting.

Additionally, there’s a VS Code extension which adds this functionality.

Trailing Whitespace VS Code Plugin

It’d be really great if it were configurable and/or auto-detected on a per-file basis by the editor, and would really help my workflow.

Thanks so much, Andrew

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:48
  • Comments:25

github_iconTop GitHub Comments

11reactions
Magendacommented, Apr 9, 2019

Is there any solution to this isuue with or without an extension? It drives me crazy for months now. I would like the cursor to be placed respecting indentation in empty lines after formatting. Thanks!

8reactions
Scatterblakcommented, Feb 14, 2020

Is there any movement on this? Really driving me crazy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git diff -w ignore whitespace only at start & end of lines
This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be equivalent." There are a ......
Read more >
How To Ignore Whitespace With Git Diff? - Tim Mousk
To ignore all line whitespaces with the git diff command, use the ignore-all-space option, like so: bash git diff --ignore-all-space.
Read more >
w ignore whitespace only at start & end of lines - Intellipaat
I love to use git diff -w to ignore whitespace differences. But, I just noticed that it ignores even whitespace differences in the...
Read more >
Git - diff-options Documentation
whitespace configuration. By default, trailing whitespaces (including lines that consist solely of whitespaces) and a space character that is immediately ...
Read more >
diff - how to ignore empty lines
To ignore whitespaces, use the -b and -w switches: -b --ignore-space-change Ignore changes in the amount of white space. -w --ignore-all-space ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found