vscode: Stage Selected Ranges broken again?
Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: 1.66.2
- OS Version: 11.6 (Big Sur)
Steps to Reproduce:
- Make some changes in a file at two different places (“1st changes” and “2nd changes”)
- Open Source Control Sidebar and select file you just changed to see the diffs for 1st & 2nd changes in the editor.
- Select the red and green diff of 1st changes, right click the selection, and choose “Stage selected ranges”. RESULT: As expected, the diff of 1st changes will disappear from the editor, the current file will appear under Staged Changes in the sidebar, and the diff of 1st changes will be visible in “Staged Changes” editor.
- Go back to the “Changes” editor and repeat step 3 for 2nd changes. EXPECTED RESULT: The same thing should happen for 2nd changes. ACTUAL RESULT: The same thing does happen for 2nd changes, but 1st changes are reverted and move from Stage Changes to Changes (i.e., 2nd changes are staged, 1st changes are unstaged.).
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 18
- Comments: 16
I commented in 2022 and I’m back now in 2024 to say I’m still regularly experiencing troubles staging additional lines after staging some. Sometimes it forgets what I staged and instead of staging additional lines on top of what was previously staged, the selective staging overrides the currently staged contents for that file entirely, making it kinda pointless for complicated staging operations.
I’ve also noticed it gets confused by multiple cursors if you try to stage lines from many places/selections/cursors and only stages the first selection properly, if at all.
I’m so annoyed at this point if I have anything complicated to stage I just open the Terminal and run gitui instead. 😕
I am experiencing the same issue, although I usually use the green (addition) and blue (change) colored ribbon-thingies (and red triangles for deletion) that appear on the left side of the code after changes. Clicking on them lets me interactively stage a single change from a file, but sometimes trying to stage more than one change, causes the previously staged changes to unstage. It’s really annoying. I thought it could be a GitLens issue (since I also use it as well), but I’ve been told this feature comes from VSCode itself.
This is also happening to me in version 1.77.3, Linux x64. I’m not attempting to stage changes on the left pane – only on the right pane. It was such a nice feature in the previous version I was using, where I never had any issues with the feature. Some notes about it:
Staged Changes
version of the file and then back to theChanges
version, in theSource Control
file selector. Doing that gets it to behave similar to the way it did when there wasn’t a problem. EDIT: I found that just alt-tabbing to any other window and back to VS Code makes the Working Tree tab update to show the staged change properly, the way it used to work, without having to alt-tab or anything else.Explorer
. Click the colored lines that show up to the left of the changed lines and to the right of the line numbers (if those are turned on). Use the plus sign button to stage the change in the line. That functionality still works. (But I prefer the side-by-side diff view. I hate that it’s not working).If you navigate away from the file after staging a selected range, it works. The issue needs to be fixed, but this crappy workaround helps in the interim.
I’m seeing this issue in WSL mode.