Skip to content

Fix inline diff view, comment labels, and diff stats accuracy#68

Merged
amandal0903 merged 3 commits intomainfrom
git-enhance-fixes
Apr 5, 2026
Merged

Fix inline diff view, comment labels, and diff stats accuracy#68
amandal0903 merged 3 commits intomainfrom
git-enhance-fixes

Conversation

@amandal0903
Copy link
Copy Markdown
Collaborator

Summary

  • Inline diff view support: Remove forced side-by-side mode, restore
    useInlineViewWhenSpaceIsLimited, and add GitHub-style L{n}/R{n} line labels for
    original/modified sides. Fix race condition in getDocumentComments and refresh widgets on
    view toggle.
  • Diff stats fix: Replace either/or logic (committed vs local changes) with a single git
    diff --numstat baseRef pass that captures committed + staged + unstaged changes accurately
    without double-counting.
  • Test coverage: Add 18 unit tests for comment controller side/label detection and 6 tests
    for diff stats (.claude/ exclusion, large untracked files, deletions, staged+unstaged
    overlap, combined scenario). Fix type errors in existing comment controller tests.

Changes

  • workstreamCommentController.ts — inline diff support, L/R labels, race condition fix
  • workstreamCommentZoneWidget.ts — widget refresh on view toggle
  • diffEditor.ts — restore inline view default
  • gitWorktreeMainService.ts — single-pass diff stats calculation
  • workstreamCommentController.test.ts — 18 new tests + type fixes
  • gitWorktreeMainService.test.ts — 6 new diff stats tests
  • copilot-instructions.md — document diff stats calculation

Test plan

  • 24 new unit tests added across comment controller and diff stats
  • Verify inline diff view renders comments from both sides
  • Toggle between split/inline and confirm widgets refresh correctly
  • Confirm diff stats show combined committed + local changes on branches ahead of main

Avijit Mandal added 3 commits April 5, 2026 21:57
- Remove forced side-by-side mode that blocked inline diff view
- Restore useInlineViewWhenSpaceIsLimited default to true
- Add GitHub-style line labels: L{n} for original, R{n} for modified
- Fix race condition in getDocumentComments via EditorOption.inDiffEditor fallback
- Show comments from both sides in inline mode on the modified editor
- Refresh widgets when user toggles between split and inline view
- Use diff computation result for consistent labels between creation and restoration
- Add 18 unit tests for controller side/label detection logic
- Remove unused CommentSide import
- Add missing updatedAt field to mock getThread return
- Use Pick<DisposableStore, 'add'> to match ensureNoDisposablesAreLeakedInTestSuite return type
The old logic used an either/or approach: show committed-against-base
stats OR local working-tree changes, never both. This meant uncommitted
edits were invisible when the branch had commits ahead.

Replace with a single `git diff --numstat baseRef` that compares the
base ref directly to the working tree, capturing committed + staged +
unstaged changes in one accurate numstat without double-counting.
Untracked files are still added separately.

Also document the diff stats calculation in CLAUDE.md/copilot-instructions.md
and add 6 new test cases covering: .claude/ exclusion, large untracked files,
file deletions, staged+unstaged overlap, and the full combined scenario.
@amandal0903 amandal0903 merged commit 5c3fa9a into main Apr 5, 2026
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