Commit Graph

2 Commits

Author SHA1 Message Date
Michael Ramos 702c87853b feat(review): token-level code selection for annotations (#500)
* feat(review): token-level code selection for annotations

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.

* fix(review): token draft roundtrip, export precision, truncation alignment

- 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.
2026-04-06 12:24:33 -07:00
김영준E cc44f6ad44 feat: Add code suggestions, inline editing, and refactor DiffViewer (#198)
* ✨ Add code suggestions, inline editing, and refactor DiffViewer

- GitHub-style suggestion blocks with syntax-highlighted diff view
- Inline annotation editing via toolbar (edit button on inline comments)
- Expandable two-pane code modal for writing suggestions
- Inline markdown rendering (bold, italic, code) in review comments
- Original code extraction from unified diff patches
- Decompose DiffViewer (615→200 lines) into focused components:
  FileHeader, InlineAnnotation, SuggestionBlock, SuggestionDiff,
  SuggestionModal, AnnotationToolbar, HighlightedCode
- Extract hooks: useAnnotationToolbar, useTabIndent
- Extract utils: detectLanguage, formatLineRange, patchParser,
  renderInlineMarkdown
- Fix suggestedCode trim stripping meaningful indentation
- Fix stale closure in useTabIndent consumers

* 🐛 Fix annotation edit field overwrite and add IME composition guard

- Conditionally spread only defined fields in handleEditAnnotation
  to prevent undefined values from wiping sibling fields
- Add !e.nativeEvent.isComposing guard to Cmd/Ctrl+Enter handlers
  in comment and suggested-code textareas for CJK input support
2026-03-01 22:00:10 -08:00