Skip to content

git: use custom dialog for dirty checkout prompt#319482

Open
sarathfrancis90 wants to merge 1 commit into
microsoft:mainfrom
sarathfrancis90:fix-git-force-checkout-enter-239062
Open

git: use custom dialog for dirty checkout prompt#319482
sarathfrancis90 wants to merge 1 commit into
microsoft:mainfrom
sarathfrancis90:fix-git-force-checkout-enter-239062

Conversation

@sarathfrancis90
Copy link
Copy Markdown

Fixes #239062

This updates the dirty worktree checkout warning to use VS Code's custom modal dialog path. Native modal dialogs keep Enter bound to the default button, so keyboard users can tab to Force Checkout and still activate the default Stash & Checkout action. The custom dialog keeps the existing modal warning and actions while allowing the focused button to handle Enter.

The checkout command now maps the selected localized label back to a semantic action before deciding whether to stash, migrate, or force checkout.

Verification:

  • npm install
  • gulp compile-extension:git
  • compiled helper assertions for the dirty worktree checkout prompt
  • npm run eslint
  • npm run vscode-dts-compile-check
  • npm run hygiene

Copilot AI review requested due to automatic review settings June 1, 2026 23:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR refactors the “dirty work tree checkout” warning into a reusable helper that uses a custom modal dialog, and adds tests to validate the behavior.

Changes:

  • Added pickDirtyWorkTreeCheckoutAction() helper and refactored checkout flow to use it.
  • Added Mocha tests covering the dialog options and return behavior.
  • Enabled the resolvers proposed API in the Git extension (tsconfig + package.json).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
extensions/git/tsconfig.json Adds proposed API d.ts reference (resolvers).
extensions/git/src/test/commands.test.ts Adds unit tests for the new checkout warning helper.
extensions/git/src/commands.ts Introduces pickDirtyWorkTreeCheckoutAction() and refactors checkout prompt logic.
extensions/git/package.json Enables resolvers proposal in extension enabledApiProposals.

Comment thread extensions/git/src/test/commands.test.ts
Comment thread extensions/git/src/commands.ts Outdated
Comment thread extensions/git/src/test/commands.test.ts
Comment thread extensions/git/package.json
@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering Bot commented Jun 1, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • extensions/git/package.json
  • extensions/git/src/commands.ts
  • extensions/git/src/test/commands.test.ts
  • extensions/git/tsconfig.json

@sarathfrancis90 sarathfrancis90 force-pushed the fix-git-force-checkout-enter-239062 branch from e8e5b76 to 772b9bf Compare June 1, 2026 23:38
@sarathfrancis90
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyboard Enter for "Force Checkout" not working

3 participants