Skip to content

fix: auto-expand diff spacers when comments exist on folded lines#333

Merged
tomasz-tomczyk merged 3 commits intomainfrom
fix/317-comments-in-folded-code
Apr 23, 2026
Merged

fix: auto-expand diff spacers when comments exist on folded lines#333
tomasz-tomczyk merged 3 commits intomainfrom
fix/317-comments-in-folded-code

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

  • When a comment targets a line inside a folded spacer gap between diff hunks, the spacer is now automatically expanded during rendering so the comment appears at its correct inline position
  • Previously, such comments fell through to the "outdated" section at the bottom of the diff, which was incorrect — the lines are valid, just folded
  • Added expandHunksForComments(file) called from both renderDiffUnified and renderDiffSplit before the hunk rendering loop

Test plan

  • 2 new Playwright e2e tests (split + unified mode)
  • 411 existing git-mode e2e tests pass
  • Go unit tests pass
  • Manual verification via make test-diff (instance 2, server.go line 59)

Closes #317

🤖 Generated with Claude Code

tomasz-tomczyk and others added 3 commits April 23, 2026 19:02
When a comment targets a line inside a folded spacer gap between diff
hunks, the spacer is now automatically expanded during rendering so the
comment appears at its correct inline position. Previously, such comments
fell through to the "outdated" section at the bottom of the diff.

Closes #317

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a server.go file with multi-hunk diff to the word-diff instance
(instance 2) and seeds a comment on line 15 (inside a spacer gap) with
an agent reply. Demonstrates the #317 fix — the spacer auto-expands to
show the comment at its correct position.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The word-diff fixture uses uncommitted working-tree changes (not a
feature branch). Committing server.go v2 meant crit saw no diff for it.
Now server.go v2 is an uncommitted change like the other files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tomasz-tomczyk tomasz-tomczyk merged commit 38aa81d into main Apr 23, 2026
4 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the fix/317-comments-in-folded-code branch April 23, 2026 18:10
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.

Issue with comments in folded code

1 participant