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.

Staging when ignoring whitespace, doesn't stage changed whitespace

See original GitHub issue

Issue Type: Bug

  1. Indent several lines of code, and save. These should appear as changes in Git.
  2. Click on “Open changes”.
  3. Ensure whitespace changes are hidden (which is the default).
  4. Select the indented lines, and stage them with “Stage selected ranges”.
  5. Nothing is staged. Even though whitespace is hidden, shouldn’t changes like indentation be staged, if they’re within the selected range? Otherwise I end up with lines like if (true) staged, since it’s a text change, but the block contained within its braces as not staged, since it’s just an indentation change.

VS Code version: Code 1.29.1 (bc24f98b5f70467bc689abf41cc5550ca637088e, 2018-11-15T19:06:21.742Z) OS version: Darwin x64 18.0.0

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:9
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
admirabiliscommented, Jul 12, 2019

To anyone arriving from Google, the current workaround is "diffEditor.ignoreTrimWhitespace": false.

4reactions
garykingcommented, Nov 22, 2018

Yeah, if I show whitespace changes, then it works. But I’m asking, why does it work that way? Meaning, if I have whitespace changes hidden, and I stage a range, then the textual changes are staged, but the whitespace changes are not staged. So I end up with a commit that has changes committed without any indentation, so I have to then stage and commit the indentation separately.

Having whitespace changes hidden definitely makes it easier to identify changes, but having to remember to turn it on before any staging every time, is a bit tedious.

Read more comments on GitHub >

github_iconTop Results From Across the Web

git - Add only non-whitespace changes - Stack Overflow
Basically we create a diff that doesn't include the space changes, ... This leaves the whitespace changes unstaged and the rest staged.
Read more >
git-show Documentation - Git
Ignore changes in amount of whitespace. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters...
Read more >
Hide whitespace changes doesn't hide all whitespace changes
Look at the diff with Show Whitespace changes both on and off, observe that whitespace changes with leading whitespace are always displayed.
Read more >
How To Ignore Whitespace With Git Diff? - Tim Mousk
The git diff command helps developers see the changes between two data sources (commits, branches, etc.). However, sometimes this command ...
Read more >
How to avoid committing whitespaces using Visual Studio and ...
If it shows that the entire file has changed, this is most definitely due to a line endings issue. That is, your text...
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