Skip to content

feat: PR review comments in Changes sidebar and diff view#216

Open
eugenioenko wants to merge 1 commit into
mainfrom
feat/pr-comments-native
Open

feat: PR review comments in Changes sidebar and diff view#216
eugenioenko wants to merge 1 commit into
mainfrom
feat/pr-comments-native

Conversation

@eugenioenko

Copy link
Copy Markdown
Owner

Summary

  • Add GitHub API functions to fetch and post PR review comments (both inline and general)
  • Integrate a Conversation section into the Changes sidebar for PR groups, showing general comments with an input to add new ones
  • Show comment count badges next to PR files that have inline review comments
  • Render inline comments as styled blocks within the diff view, placed between diff lines at their corresponding positions
  • Add two new theme-aware styles (StyleCommentBg, StyleCommentAuthor) following the existing theme pipeline
  • Wire async comment fetching into the existing PR load flow and auto-refresh after posting

Design approach

No new panels, overlays, or widgets. Comments are integrated directly into the existing Changes widget (sidebar) and DiffViewWidget (editor area), matching existing patterns:

  • New changesItemKind values (itemConvoSection, itemComment, itemCommentInput) extend the virtual item list
  • diffDisplayRow interleaves comment blocks with diff lines in the display row list
  • Callbacks (OnAddComment, OnViewComment) follow the existing callback-driven architecture
  • Async results (PrCommentAddResult, PrCommentsRefreshResult) use the standard PostEvent(EventInterrupt) pattern

Test plan

  • Unit tests for FormatCommentTime, CommentsForFile, GeneralComments, FileCommentCounts
  • All existing tests pass (go test ./... -- the only failure is pre-existing TestLoadNoFiles)
  • Build succeeds (make build)
  • Manual: open a PR with gh pr open <url>, verify conversation section appears
  • Manual: verify comment count badges show next to files with inline comments
  • Manual: open a PR diff, verify inline comments render between diff lines
  • Manual: add a general comment via the sidebar input, verify it posts and refreshes

🤖 Generated with Claude Code

…ng UI

Integrate PR review comments directly into the existing Changes sidebar
and diff view, matching the native editor look and feel with no new panels
or overlays.

Changes:
- Add GitHub API functions to fetch, add general, and add inline PR comments
- Extend ChangesGroup with comment data, conversation section, and comment input
- Show comment count badges next to PR files with inline comments
- Add expandable Conversation section in PR groups showing general comments
- Render inline comments as styled blocks within the diff view between lines
- Add two new theme-aware style constants (StyleCommentBg, StyleCommentAuthor)
- Wire async comment fetching into the PR load flow
- Add comment submission via the sidebar input with async posting
- Auto-refresh comments after adding a new one
- Update open diff tabs when comments are refreshed
- Unit tests for comment filtering, counting, and formatting helpers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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