Skip to content

Git - git.stage shortcut loses file list focus #207066

Description

Does this issue occur when all extensions are disabled?: No, it's related to the git extension

  • VS Code Version:
Version: 1.87.0 (Universal)
Commit: 019f4d1419fbc8219a181fab7892ebccf7ee29a2
Date: 2024-02-27T23:42:56.944Z (1 wk ago)
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
  • OS Version:
    Darwin arm64 22.5.0

Steps to Reproduce:

  1. Add this keybind in vscode:
    {
        "key": "ctrl+alt+m",
        "command": "git.stage",
        "when": "view.workbench.scm.visible"
    },
  1. Have some unstaged files and focus on one
image
  1. Click ctrl + option + m to stage your selected file
  2. Previously the focus would go to the next item of the list, but now the focus go to the workbench view, which is pretty annoying when you want to do that multiple times in multiple files

I used this shortcut massively last year and a recent update (something like 1-2 moths ago broke it)

Activity

  1. added
    bug
    scm
    on Mar 20, 2024
  2. fallenworld1 commented on Mar 28, 2024

    @fallenworld1

    I would like to add that there is also git.stageAll and git.unstageAll which always asks for repo even if there is one in focus, would be nice to have them worked. In that case workflow would be like this:

    1. focus source control view
    2. stage all files or go through every file with up, down and space or enter to review and stage what's needed
    3. unstage some files (if stageAll was used)
    4. ctrl + enter to commit

    right now i have to either use mouse or move focus back to "source control view" every time

  3. LeonardoRick commented on Oct 11, 2024

    @LeonardoRick
    Author

    Hey! Any updates on this? 😬

    It's being a while and I would love to get this fluid behaviour as before.

    I wish I had the knowledge to contribute as well. If anyone could provide me some directions I could try digging into it.

    Thanks!

  4. dannypernik commented on Oct 14, 2024

    @dannypernik

    This is important to me too and deserves attention

  5. finnmerlett commented on Oct 22, 2024

    @finnmerlett

    Likewise I've found the loss of focus behaviour here infuriating - for something so small and easy to fix, this issue as been on and off in vscode for ages. Would love to see it properly addressed

  6. SalhiYassine commented on Nov 3, 2024

    @SalhiYassine

    Pls fix

  7. changed the title [-]git.stage shortcut loses file list focus[/-] [+]Git - git.stage shortcut loses file list focus[/+] on Dec 17, 2024
  8. lszomoru commented on Dec 17, 2024

    @lszomoru
    Member

    Leonardo Rick (@LeonardoRick), sorry for not getting back to you on this until now. When you invoke the command using the keybinding, do you have the file that you are staging opened in the editor? I am asking since invoking the git.stage command using a keybinding only works if the file is opened in the editor, since the command does not have access to the selected item in the list.

  9. vivasvan1 commented on Dec 31, 2024

    @vivasvan1

    +1

  10. scintillavoy commented on Jan 6, 2025

    @scintillavoy

    When you invoke the command using the keybinding, do you have the file that you are staging opened in the editor?

    Ladislau Szomoru (@lszomoru) I am not the original author, but yes, I open the file first and invoke the command to stage or unstage it. Here are short videos showing how the behaviors differ.

    Until VS Code version 1.85.2:

    Screen.Recording.2024-03-11.at.22.30.20.mov

    From VS Code version 1.86.0:

    Screen.Recording.2024-03-11.at.22.32.12.mov
  11. lszomoru commented on Jan 23, 2025

    @lszomoru
    Member

    Dongyoung Moon (@scintillavoy), thank you very much for the recording. Will look into this and update the issue.

  12. removed this from the On Deck milestone on Jan 23, 2025
  13. 28 remaining items

  14. vivasvan1 commented on Jul 11, 2025

    @vivasvan1

    Fix this bill gates!!

  15. dannypernik commented on Jul 30, 2025

    @dannypernik
  16. LeonardoRick commented on Oct 12, 2025

    @LeonardoRick
    Author

    Any directions here?? I really miss this

  17. dannypernik commented on Jan 3, 2026

    @dannypernik

    Ladislau Szomoru (@lszomoru) João Moreno (@joaomoreno) happy new year. Would love to see this fixed in 2026.

  18. dobbydobap commented on Jul 7, 2026

    @dobbydobap
    Contributor

    happy to take this if it's still open. digging in: #201309 removed the general list/tree focus preservation and re-added it explicitly to the explorer (focusNext/focusLast in explorerView), but the scm view never got the equivalent, that's why staging drops focus. i can add the same to the scm tree following your outline: focus the next resource on removal, and the resource group when the last one goes. planning to prefer next over previous (per point about staging in succession) but shout if you'd rather previous, or if you're already on it.

  19. finnmerlett commented on Nov 11, 2026

    @finnmerlett

    Well, I guess if you want something done, do it yourself 👀

    I've just released a VSCode extension, Focus Next On Stage, that adds this functionality back in. I've been using it the past week and it really does improve the experience of staging files. It even lets you prioritise focusing the next file in the current folder (rather than always focusing the next file down) via an optional setting.

    Drop an issue on the repo if you have any problems, otherwise - Happy Staging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugconfirmedscm

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions