Skip to content

feat(review): add multiline comment selections - #931

Open
benvinegar wants to merge 1 commit into
mainfrom
feat/multiline-comment-selections
Open

feat(review): add multiline comment selections#931
benvinegar wants to merge 1 commit into
mainfrom
feat/multiline-comment-selections

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Summary

  • replace automatic copy-on-release with persistent mouse and keyboard code selections
  • add explicit Comment, Copy, and Clear actions with a viewport-aware bordered action menu
  • preserve exact multiline and dual-sided note ranges through review state, persistence, session protocol, extensions, editing, and threaded replies
  • keep selection highlighting source-only and make the hover [+] affordance overlay the note guide instead of shifting it

Behavior

Reviewers can drag across code or press v and navigate to create a persistent selection. c opens a range-targeted comment, y copies the selected text, and Esc clears the selection contextually without taking Escape away from extension modes.

Selections survive vertical scrolling but clear when layout or source geometry changes. Stack-mode replacement selections can include both old and new ranges; split-mode selections remain constrained to one side. Presentation-only rows such as inline notes and hunk headers may be crossed when the underlying source coverage remains contiguous.

Range identity remains semantic rather than text-derived. Saved multiline notes retain their preferred endpoint and owner hunk through reloads, edits, replies, terminal projection, and protocol round trips.

Verification

  • bun run typecheck
  • bun run test — 2,112 passed, 3 skipped
  • bun run test:integration — 140 passed, 1 platform skip
  • bun run deps:check
  • bun test scripts/source-boundaries.test.ts
  • targeted selection, protocol, rendering, threading, and composer tests
  • real PTY coverage for mouse selection → Comment → save with exact range assertions
  • manual tmux checks across stack/split, wrapping, scrolling, gutters, inline notes, and composer save/cancel

Tested on Linux. PTY/TTY behavior was not manually tested on macOS or Windows.

Visual evidence

The hover regression reproduced here is covered by a rendering regression test; [+] now overlays the trailing note guide rather than pushing it left:

https://glance.sh/0iqc6zB9OhWpe5wA8P7F.png

This PR description was generated by Pi using gpt-5.6-sol

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hunk-web Ignored Ignored Preview Aug 31, 2026 12:07am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds persistent mouse and keyboard code selections with explicit Comment, Copy, and Clear actions, and carries multiline or dual-sided note ranges through review state and session-facing contracts.

  • Adds semantic range anchors with preferred endpoints and owner-hunk preservation.
  • Adds selection projection, highlighting, action-menu placement, clipboard extraction, and contextual keyboard handling.
  • Extends protocol, extension, editing, reply, persistence, and test coverage for range-targeted notes.
  • Updates command documentation and resolves the example extension’s previous y binding conflict.

Confidence Score: 5/5

The PR appears safe to merge; no concrete changed-code defect remained after tracing selection geometry, command ownership, anchor preservation, and protocol validation.

Selection invalidates when source or rendered geometry changes, copy and comment actions use the same committed projection as highlighting, and multiline anchors retain their ranges and ownership through local and remote review flows.

Important Files Changed

Filename Overview
src/ui/components/panes/DiffPane.tsx Implements persistent mouse and keyboard selection state, invalidation, action-menu placement, and Comment/Copy/Clear dispatch without an identified actionable defect.
src/ui/components/panes/copySelection.ts Projects rendered selections into contiguous source ranges and shared copy/highlight output, including split-side and presentation-row constraints.
src/core/review/anchors.ts Extends note anchors to preserve multiline and dual-sided ranges, preferred endpoints, intersections, and owner-hunk placement.
src/core/review/intents.ts Carries exact range anchors through draft creation, saving, editing, and replies while retaining atomic intent validation.
src/app/session/reviewCommands.ts Adds producer-side range coverage checks and exact-anchor save preconditions for remote review actions.
src/session/reviewProtocol.ts Extends runtime parsing and wire types for validated line-or-range note targets.
src/ui/hooks/useAppKeyboardShortcuts.ts Adds contextual Escape clearing while preserving established modal, input, file-view, and extension-mode ownership.
src/extension-api/types.ts Exposes range-aware note data through the public extension types without changing host ownership of review geometry.

Sequence Diagram

sequenceDiagram
    actor Reviewer
    participant Diff as Diff selection UI
    participant Geometry as Range projection
    participant Review as Review state/intents
    participant Protocol as Session protocol
    participant Notes as Saved notes

    Reviewer->>Diff: Drag rows or press v and navigate
    Diff->>Geometry: Project rendered endpoints
    Geometry-->>Diff: Semantic old/new ranges + preferred endpoint
    Reviewer->>Diff: Comment
    Diff->>Review: Start range-targeted draft
    Review->>Review: Resolve owner and intersecting hunks
    Reviewer->>Review: Save, edit, or reply
    Review->>Notes: Preserve semantic anchor
    Protocol->>Review: Parse and validate remote range actions
    Review-->>Protocol: Applied revision or stable failure
Loading

Reviews (1): Last reviewed commit: "feat(review): add multiline comment sele..." | Re-trigger Greptile

@benvinegar
benvinegar force-pushed the feat/multiline-comment-selections branch from 5c1a589 to 4ec14d4 Compare August 30, 2026 22:40
@benvinegar
benvinegar force-pushed the feat/multiline-comment-selections branch from 4ec14d4 to b8a3553 Compare August 31, 2026 00:07
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.

1 participant