Microsoft/vscode

Expose command and context key to close Dirty Diff inline view

开放

#265,297 创建于 2025年9月5日

 (4 条评论) (0 个反应) (1 位负责人)TypeScript (39,847 个派生)batch import
AndroidGood first issueUIfeature-requesthelp wantedscm

仓库指标

星标
 (184,936 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南