Microsoft/vscode

Expose command and context key to close Dirty Diff inline view

Open

#265,297 opened on Sep 5, 2025

View on GitHub
 (4 comments) (0 reactions) (1 assignee)TypeScript (10,221 forks)batch import
feature-requesthelp wantedscm

Repository metrics

Stars
 (74,848 stars)
PR merge metrics
 (Avg merge 11h 43m) (1,000 merged PRs in 30d)

Description

Currently, the "Dirty Diff" inline view (the zone widget that appears when using "Show Previous Change" on a modified line gutter) can only be closed by clicking the small "x" button with the mouse.

Problem:

  • The Dirty Diff widget is not focusable from the editor using the keyboard (arrow keys or tab do not reach it).
  • There is no public command exposed to close it (closeDirtyDiff is not available in the command registry).
  • As a result, it's impossible to bind a keyboard shortcut (e.g. Escape) to close this view.

Expected / Feature request:

  • Expose a command like git.closeDirtyDiff.
  • Provide a when context key (e.g. dirtyDiffVisible) that evaluates to true when the Dirty Diff widget is open.

Benefits:

  • Keyboard users (or users with accessibility needs) would be able to close the Dirty Diff without touching the mouse.
  • Consistency with Peek editors, which already support both a command and a context key for closing.

Steps to reproduce current limitation:

  1. Open a file with uncommitted changes.
  2. Click in the gutter and choose "Show Previous Change".
  3. The Dirty Diff widget appears.
  4. Press Escape → nothing happens, the widget remains open.
  5. No command exists in the Command Palette or keybindings.json (to my knowledge ) to close it.

This makes it impossible to close the widget using only the keyboard.

Config

Version: 1.103.2
Commit: 6f17636121051a53c88d3e605c491d22af2ba755
Date: 2025-08-20T16:45:34.255Z
Electron: 37.2.3
ElectronBuildId: 12035395
Chromium: 138.0.7204.100
Node.js: 22.17.0
V8: 13.8.500258-electron.0
OS: Darwin arm64 24.6.0

Contributor guide