Skip to content

feat(review): token-level code selection for annotations#500

Merged
backnotprop merged 2 commits intomainfrom
feat/diff-tokens
Apr 6, 2026
Merged

feat(review): token-level code selection for annotations#500
backnotprop merged 2 commits intomainfrom
feat/diff-tokens

Conversation

@backnotprop
Copy link
Copy Markdown
Owner

Summary

  • Adds token-level click interaction to the diff viewer using Pierre v1.1.12's onTokenClick/onTokenEnter/onTokenLeave callbacks
  • Click a syntax token → annotation toolbar opens with token text context (e.g. Line 47: `processOrder`)
  • Token metadata (charStart, charEnd, tokenText) stored on CodeAnnotation and surfaced in sidebar badges + feedback export
  • Gutter line selection continues to work independently — no behavioral changes to existing flows

Stacked on

feat/hook-up-review-ai — will auto-retarget to main when parent merges.

Test plan

  • bun run dev:review — hover tokens, confirm underline appears
  • Click a token — toolbar opens with token text in header
  • Click same token again — deselects
  • Click gutter line numbers — line selection works as before, no token state leaks
  • Submit a token annotation — sidebar card shows token badge
  • Send feedback — exported markdown includes token context in heading
  • bun run build:hook — clean build

@backnotprop backnotprop changed the base branch from feat/hook-up-review-ai to main April 6, 2026 19:16
Add the ability to click individual syntax tokens in the diff viewer to
create annotations with precise code context. Uses Pierre v1.1.12's
onTokenClick/onTokenEnter/onTokenLeave callbacks.

- Click a token → toolbar opens with token text in header
- Click same token again → deselects
- Gutter line selection still works independently
- Token metadata (charStart, charEnd, tokenText) stored on CodeAnnotation
- Sidebar shows token badge, export includes token context

For provenance purposes, this commit was AI assisted.
…nment

- Persist tokenSelection in drafts so token context survives file switches
- Include char offsets in exported feedback for duplicate token disambiguation
- Escape backticks in token text to prevent broken markdown fences
- Align sidebar token truncation to 30 chars (matching toolbar header)

For provenance purposes, this commit was AI assisted.
@backnotprop backnotprop merged commit 702c878 into main Apr 6, 2026
5 checks passed
@backnotprop backnotprop deleted the feat/diff-tokens branch April 6, 2026 19:24
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