Skip to content

Paint selection and whole-line decoration backgrounds across view zones#317264

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/improve-codelens-behaviour
Draft

Paint selection and whole-line decoration backgrounds across view zones#317264
Copilot wants to merge 3 commits into
mainfrom
copilot/improve-codelens-behaviour

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

View zones (code lens, AI-inserted region headers, etc.) sandwiched between two selected — or whole-line-decorated — lines do not pick up the surrounding background, leaving a visible gap in an otherwise contiguous band:

codelens gap in selection

Changes

  • New view part ViewZoneBackgrounds (src/vs/editor/browser/viewParts/viewZoneBackgrounds/)
    • Listens to cursor, decoration, zone, scroll, lines and line-mapping events.
    • On render, walks viewportData.whitespaceViewportData and, for each whitespace whose gap between view lines afterLineNumber and afterLineNumber + 1 is fully enclosed by a selection, emits a cslr selected-text div at the whitespace's vertical offset. Same logic for any isWholeLine decoration with a className, emitting a cdr <className> div — so multi-line backgrounds (e.g. AI-inserted regions) read as one band across the zone.
    • Skips afterLineNumber === 0 (before line 1) and zero-height (hidden-area) whitespaces.
  • Wired in view.ts between viewZones.domNode and viewLines.getDomNode(). This z-order covers empty view zones (codelens reservation) while staying under view lines and content widgets, so the codelens text — rendered as a content widget — remains on top.

A gap is considered enclosed by range when:

range.startLineNumber <= beforeLine && range.endLineNumber >= afterLine

Copilot AI requested review from Copilot and removed request for Copilot May 19, 2026 07:21
Copilot AI linked an issue May 19, 2026 that may be closed by this pull request
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 19, 2026 07:34
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 19, 2026 07:36
Copilot AI changed the title [WIP] Improve codelens and selection/decoration behaviour Paint selection and whole-line decoration backgrounds across view zones May 19, 2026
Copilot AI requested a review from dmitrivMS May 19, 2026 07:36
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.

Improve codelens and selection/decoration behaviour

2 participants