Skip to content

fix: keep deletion gutter marker visible when adjacent fold is collapsed#304996

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/dirty-diff-gutter-folding
Open

fix: keep deletion gutter marker visible when adjacent fold is collapsed#304996
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/dirty-diff-gutter-folding

Conversation

@yogeshwaran-c
Copy link
Contributor

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

When a line is deleted between two foldable regions (e.g., between two #region blocks in HTML), the red deletion marker in the gutter disappears when the region above the deletion is folded. This happens because the deletion decoration is a zero-width range at the end of the last line of the fold, and that line becomes hidden when the fold is collapsed.

Closes #246388

What is the new behavior?

The deletion decoration range now extends from the end of startLineNumber to the beginning of startLineNumber + 1 (when a next line exists). This ensures that if the line before the deletion is hidden by folding, the marker still appears on the next visible line.

For the last line of the file (no next line), the behavior remains unchanged.

Additional context

  • The change is in QuickDiffDecorator.onDidChange() in src/vs/workbench/contrib/scm/browser/quickDiffDecorator.ts
  • Only the ChangeType.Delete case is affected; Add and Modify decorations are unchanged
  • The decoration still uses isWholeLine: false so it appears as the small deletion indicator, not a full-line decoration

When a deletion occurs between two foldable regions, the deletion marker
disappears when the region above is folded. This happens because the
decoration range is a zero-width point on the last line of the fold.

Fix by extending the deletion decoration range to include the start of
the next line so the marker remains visible when the preceding line is
hidden by folding.

Closes microsoft#246388
@vs-code-engineering
Copy link
Contributor

📬 CODENOTIFY

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

@lszomoru

Matched files:

  • src/vs/workbench/contrib/scm/browser/quickDiffDecorator.ts

@vs-code-engineering vs-code-engineering bot added this to the 1.114.0 milestone Mar 26, 2026
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.

Git: deletion marker in the gutter disappears when folding adjacent regions

2 participants