Repository navigation
feat(diff-comments): add multi-line range selection with drag and keyboard - #20959
Conversation
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (21)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change adds ranged diff comments. Shared helpers normalize line ranges and selections. A drag controller supports gutter selection, hunk-boundary clamping, auto-scroll, cancellation, and decorations. The add-button overlay and decorator use the controller. The Add Review Note shortcut opens single-line or ranged composers. Popover keys include both line bounds. CSS and unit, component, and end-to-end tests cover the new behavior. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No concrete correctness or usability issue remains from the reviewed range-selection changes. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the problem, solution, implementation, and automated tests, but required information is incomplete. The linked issue is missing, visual proof is still marked TODO, manual testing is unchecked, and several checklist and template sections are incomplete. Resolution Add the issue number after "Fixes #". Attach the required before/after video and keyboard-flow screenshot. Document manual testing and tested platforms. Complete the ELI5, Why, AI Disclosure if applicable, Review, Notes, and remaining checklist items, including command and CI status. Full details: Docstring CoverageExplanation Docstring coverage is 27.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 48 functions across 20 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 1527024b-cd56-4fdd-9f55-e358de0dda10
📒 Files selected for processing (21)
src/renderer/src/assets/main.csssrc/renderer/src/components/diff-comments/diff-comment-add-button-overlay.tssrc/renderer/src/components/diff-comments/diff-comment-add-note-shortcut.tssrc/renderer/src/components/diff-comments/diff-comment-drag-auto-scroll.test.tssrc/renderer/src/components/diff-comments/diff-comment-drag-auto-scroll.tssrc/renderer/src/components/diff-comments/diff-comment-editor-test-fixture.tssrc/renderer/src/components/diff-comments/diff-comment-line-range.test.tssrc/renderer/src/components/diff-comments/diff-comment-line-range.tssrc/renderer/src/components/diff-comments/diff-comment-range-drag.test.tssrc/renderer/src/components/diff-comments/diff-comment-range-drag.tssrc/renderer/src/components/diff-comments/useDiffCommentDecorator.commentable-lines.test.tsxsrc/renderer/src/components/diff-comments/useDiffCommentDecorator.model-lifecycle.test.tsxsrc/renderer/src/components/diff-comments/useDiffCommentDecorator.range-selection.test.tsxsrc/renderer/src/components/diff-comments/useDiffCommentDecorator.tsxsrc/renderer/src/components/editor/DiffSectionBody.tsxsrc/renderer/src/components/editor/DiffSectionItem.tsxsrc/renderer/src/components/editor/DiffViewer.tsxsrc/renderer/src/components/editor/MonacoMarkdownAnnotationOverlay.tsxsrc/renderer/src/components/editor/monaco-markdown-selection-annotation.tssrc/renderer/src/components/editor/use-monaco-markdown-annotations.tstests/e2e/diff-note-line-range.spec.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
There was a problem hiding this comment.
Important
The gutter drag is installed on every surface that uses the decorator, not just diffs, and it claims more of the gutter than the gesture needs. On the markdown annotations editor it swallows Monaco's fold chevrons (and turns line-number presses into comment gestures). Narrowing the intercepted target types keeps the drag while leaving stock Monaco gestures intact.
Reviewed changes
- New range helpers (
diff-comment-line-range.ts): ordering/clamping/selection math shared by the drag, the chord and the markdown path, withstartLineomitted for single lines so the stored shape is unchanged. - Gutter drag controller (
diff-comment-range-drag.ts+diff-comment-drag-auto-scroll.ts): pointer-capture drag, per-frame hit-test against a fixed probe column, edge auto-scroll, hunk clamping, Escape/pointercancel abort. - Overlay/decorator wiring (
diff-comment-add-button-overlay.ts,useDiffCommentDecorator.tsx): the overlay owns the drag and exposessetPendingRange; the decorator threadspendingCommentTargetso the band stays lit under the open composer. - Keyboard chord (
diff-comment-add-note-shortcut.ts):editor.addReviewNoteopens a ranged composer from the editor selection; popover keys now includestartLine. - Tests: unit suites for range math, drag physics, auto-scroll and decorator range/chord/drag, plus
tests/e2e/diff-note-line-range.spec.ts.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
edd67b6 to
5c61b28
Compare
There was a problem hiding this comment.
Important
The e2e / changed e2e specs check is red on this head — every test in tests/e2e/diff-note-line-range.spec.ts fails at gutterPoint with line N is not rendered in the modified gutter, identically to the prior commit's run. This commit's helper rewrite does not address the cause, and the upward-drag test added here is among the failures.
Reviewed changes
- Gutter press narrowed to line numbers (
diff-comment-range-drag.ts):GUTTER_PRESS_TARGET_TYPESdropsGUTTER_GLYPH_MARGINandGUTTER_LINE_DECORATIONS, so fold chevrons and glyph-margin presses reach Monaco while the+press still resolves through the button (plus.contains, not a Monaco target). - Directional selection clamping (
diff-comment-line-range.ts,diff-comment-add-note-shortcut.ts): the newgetSelectionAnchorFocusreads Monaco's anchor/active endpoints, so the chord clamps an upward selection from the line it was anchored on instead of the hunk above. - Drag state exposed to keyboard paths (
diff-comment-range-drag.ts,diff-comment-add-button-overlay.ts,useDiffCommentDecorator.tsx):isDragging()is OR-ed intoisComposerOpen, so a chord pressed mid-drag is consumed rather than opening a composer on the stale editor selection. - Tests: unit coverage for the anchor/focus direction, the narrow gutter target set, and
isDragging; a new upward-drag e2e case (currently failing on CI).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
5c61b28 to
ed5b917
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/renderer/src/components/diff-comments/diff-comment-editor-test-fixture.ts (1)
91-91: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReturn a stable model reference from the fixture.
getModel()allocates a new object on every call. Monaco returns the sameITextModelreference until the model is replaced, and the decorator suites key model-lifecycle behavior on that identity. With a new object per call, a model-swap path can appear to run on every render, souseDiffCommentDecorator.model-lifecycle.test.tsxmay assert against fixture behavior rather than editor behavior.Hoist one object.
setLineCountkeeps working because the getter closes overlineCount.♻️ Proposed fix
const noopDisposable: IDisposable = { dispose: () => {} } + // Monaco hands back the same model reference until the model is replaced. + const model = { getLineCount: () => lineCount }- getModel: () => ({ getLineCount: () => lineCount }), + getModel: () => model,
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 32cd1dd1-c5fc-4d2f-85ca-b8c76145246d
📒 Files selected for processing (21)
src/renderer/src/assets/main.csssrc/renderer/src/components/diff-comments/diff-comment-add-button-overlay.tssrc/renderer/src/components/diff-comments/diff-comment-add-note-shortcut.tssrc/renderer/src/components/diff-comments/diff-comment-drag-auto-scroll.test.tssrc/renderer/src/components/diff-comments/diff-comment-drag-auto-scroll.tssrc/renderer/src/components/diff-comments/diff-comment-editor-test-fixture.tssrc/renderer/src/components/diff-comments/diff-comment-line-range.test.tssrc/renderer/src/components/diff-comments/diff-comment-line-range.tssrc/renderer/src/components/diff-comments/diff-comment-range-drag.test.tssrc/renderer/src/components/diff-comments/diff-comment-range-drag.tssrc/renderer/src/components/diff-comments/useDiffCommentDecorator.commentable-lines.test.tsxsrc/renderer/src/components/diff-comments/useDiffCommentDecorator.model-lifecycle.test.tsxsrc/renderer/src/components/diff-comments/useDiffCommentDecorator.range-selection.test.tsxsrc/renderer/src/components/diff-comments/useDiffCommentDecorator.tsxsrc/renderer/src/components/editor/DiffSectionBody.tsxsrc/renderer/src/components/editor/DiffSectionItem.tsxsrc/renderer/src/components/editor/DiffViewer.tsxsrc/renderer/src/components/editor/MonacoMarkdownAnnotationOverlay.tsxsrc/renderer/src/components/editor/monaco-markdown-selection-annotation.tssrc/renderer/src/components/editor/use-monaco-markdown-annotations.tstests/e2e/diff-note-line-range.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/components/diff-comments/useDiffCommentDecorator.model-lifecycle.test.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- E2E seed now commits a tracked baseline (
tests/e2e/diff-note-line-range.spec.ts):seedDiffFilewrites the baseline through Nodefs, commits it when the path is dirty, then rewrites the 24-line working tree on top — so the file is an unstaged modification of a tracked file rather than an untracked file whose inline diff opens with no gutter lines. - Readiness gate replaced with a poll: the seed waits on the new
hasGutterLine(page, 9)for the modified model to render its later gutter lines before anygutterPointcall, removing the race the prior review flagged.
Verified locally with CI=1 SKIP_BUILD=1 ORCA_E2E_HEADLESS=1 ORCA_BACKGROUND_LAUNCH=1 xvfb-run -a npx playwright test --config tests/playwright.config.ts --project=electron-headless tests/e2e/diff-note-line-range.spec.ts → all 6 tests pass, and the e2e / changed e2e specs check is green on this head.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
ed5b917 to
f3430b1
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Re-reviewed the delta since the prior pullfrog review on ed5b917 (the branch was rebased onto main, so the range-diff isolates the semantic change): a gutter-drag release fix plus test and e2e-helper hardening.
- Release coordinate captured on
pointerup(diff-comment-range-drag.ts): the drag now adoptsevent.clientYand resolves the focus line before committing, so a release on a line nopointermoveever reported commits the line the user released on instead of a stale one. The coalesced-frame hit-test was extracted intoresolveFocusLine, and the final auto-scroll step on release was dropped — correct, since the gesture is over and further scrolling would only push the committed range past the released line. - Drag test coverage (
diff-comment-range-drag.test.ts): a new case presses and releases across lines with no intervening move; the harness now releases at the pointer's last reported position. - Fixture model identity (
diff-comment-editor-test-fixture.ts): the fake editor returns one stable model reference, matching Monaco'sITextModellifetime. - E2E gutter lookups hardened (
tests/e2e/diff-note-line-range.spec.ts):readGutterPointis shared, andgutterPointpolls for the target cell instead of throwing on a transient miss.
Verified the three changed unit suites locally (diff-comment-range-drag.test.ts, useDiffCommentDecorator.range-selection.test.tsx, useDiffCommentDecorator.commentable-lines.test.tsx) — 43 tests pass. Typecheck and static analysis are green on f3430b1; the e2e/tests checks were still running at review time.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Enable users to select a range of lines for diff comments by dragging in the gutter, with auto-scroll and visual feedback. Add keyboard shortcut (Mod+Shift+A) to open a comment on the editor selection. Extract line-range logic into testable utilities and add comprehensive test coverage including E2E scenarios.
- Preserve anchor/focus directionality in selections to handle upward drags correctly - Restrict gutter presses to line numbers only, leaving fold chevrons to Monaco - Prevent add-note chord from opening composer while a gutter drag is in progress
Pointerup can arrive at a position no pointermove event reported, causing fast drags to lose their final lines if the release landed before the animation frame fired. Capture the release coordinate and resolve it before committing the range. Also: extract resolveFocusLine for clarity, improve test harness to track pointer position, add polling to gutter detection for rendering delays.
f3430b1 to
aa952c8
Compare

Problem
Diff comments were limited to single lines, matching only basic review tools. Modern code review requires selecting ranges to comment on related logic.
Solution
Added multi-line range selection via two gestures:
The implementation:
Visual Proof
Testing
tests/e2e/diff-note-line-range.spec.tscovers gutter drag, button drag, single-line click, Escape abort, and keyboard chordLinked Issue
Fixes #
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Ensure no issues in: Security (pointer capture released properly), Cross-platform support (keyboard shortcuts tested on Mac/Linux/Windows with correct modifiers), Remote SSH (gutter gesture over SSH terminal-rendered diffs), Mobile (touch ignored; pane scrolling preserved), backward compatibility (single-line notes wire-identical to before).
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)