Skip to content

command:git.diff.stageHunk only trigger by sider UI botton. #253895

@jiahaoxiang2000

Description

@jiahaoxiang2000

Does this issue occur when all extensions are disabled?: Yes

Version: 1.101.2
Commit: 2901c5a
Date: 2025-06-24T20:27:15.391Z
Electron: 35.5.1
ElectronBuildId: 11727614
Chromium: 134.0.6998.205
Node.js: 22.15.1
V8: 13.4.114.21-electron.0
OS: Linux x64 6.15.3-arch1-1

Steps to Reproduce:

  1. Open a diff view in VS Code
  2. Run the command git.diff.stageHunk (related code: https://github.com/microsoft/vscode/blob/0f58db74803c27f10770568b4bd8fec037bc2cdc/extensions/git/src/commands.ts#L1646C1-L1649C3)

Current Behavior:
The command doesn't stage anything when no selection is made.

Expected Behavior:
When running git.diff.stageHunk without a selection, it should automatically stage the hunk under the cursor.

Suggested Implementation:
The function this.diffStageHunkOrSelection(changes) could be enhanced with a default behavior to stage the hunk under the cursor when no selection is present. This would greatly improve the experience for keyboard-driven users. Also happened on #240935.

Benefits:

  • Eliminates the need to manually select hunks before staging
  • Provides intuitive behavior for cursor-based operations
  • Improves workflow efficiency for keyboard users

Metadata

Metadata

Assignees

Labels

insiders-releasedPatch has been released in VS Code Insiders

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions