Skip to content

Add read-only table comparison with aligned cell differences - #123

Closed
jonaraphael wants to merge 2 commits into
codex/large-file-previewfrom
codex/csv-table-compare
Closed

jonaraphael wants to merge 2 commits into
codex/large-file-previewfrom
codex/csv-table-compare

Conversation

@jonaraphael

@jonaraphael jonaraphael commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

CSV files need a table comparison that identifies changed cells and keeps inserted/deleted records aligned. Add CSV: Compare Files as Table, available from an active file plus a picker or two selected Explorer files. One read-only webview displays both inputs, highlights original/modified cell differences, synchronizes both scroll axes and multiline row heights, and provides page/change navigation. Long filenames stay on one line with their full escaped names in tooltips.

Related to #67 and #86. This provides an explicit comparison for a known URI pair; it does not replace native Git/PR custom-editor diffs or fully resolve those native integration requests.

Behavior and limits

  • Read current VS Code TextDocuments, including dirty edits and VS Code's selected decoding. Source changes refresh the comparison. Both panes are read-only; no file writes, cell-value logging, uploads, or persistent table data are added.
  • Align equal records with bounded LCS/unique-row anchors, then use shared-field similarity to pair nearby replacements. Missing records/fields have placeholders; field presence and decoded cell values are compared, not source quoting or line-ending style. The first record remains data.
  • Honor csv.enabled, separator overrides/settings, and csv.maxFileSizeMB. Independently reject saved sources above 10 MiB before opening TextDocuments, even when the configured soft limit is zero; stat-less sources must already be open. Decoded input is capped at 5 MiB, 10,000 records, 100,000 cells, 1,000 columns, 64 Ki characters/value and 256 Ki characters/record. Pages cap rendered body rows/cells/text; a visible notice identifies large sections that fall back to positional alignment after the work budget. No data is silently truncated.
  • Add one command/context-menu entry and README documentation; no new settings.

Native API limitation

The supported stable CustomTextEditorProvider API supplies one document/webview at a time. The installed VS Code 1.117.0 native-source probe and VS Code 1.100 tab DTO implementation do not expose a reliable TabInputTextDiff pair when the native comparison contains custom editor inputs. VS Code's shared custom diff editor work is outside this extension's stable API contract. The native reopen-as-text implementation replaces the active custom input with one canonical resource, so this PR does not add a fallback that could discard the pair. These are source/API findings, not an end-to-end native Git diff test.

Validation

  • Node 20: npm ci, npm run compile, npm test — 190/190 passing, including 22 new behavior tests.
  • npm run lint — zero errors; the existing 87 curly warnings remain.
  • npm run package -- --out /tmp/csv-table-compare.vsix — passed, including the new external script and compiled modules.
  • Model regressions cover insert/delete plus modification, duplicate rows, multiline/doubled quotes, CSV/TSV/PSV, BOM/Unicode, ragged empty fields, exact-once source coverage, bounded large alignment/fallback, malformed/oversized input and page limits.
  • Host/frontend regressions cover dirty/reopened document refresh, errors/disposal, huge-source checks before opening with maxFileSizeMB=0, stat-less remote input, picker cancellation, escaped values/titles, read-only controls, filename layout contract, matching row heights, both scroll directions, bounded page replacement, stale/last-change requests restoring controls, and focus positioning with pane/table offsets and a sticky header.
  • Independent actual Chromium fixture QA passed: highlights and literal markup escaping, long/short filename pane origins, all 22 paired row heights (including 180px multiline rows), horizontal/vertical synchronization in both directions, and Next Change positioning exactly below the sticky header after a geometry correction. The fixture runs the real model/HTML/script with a mocked host; it is not a native VS Code integration test. Screenshot retained locally at /tmp/csv-table-comparison-review.png.

Stacked on #119 (codex/large-file-preview); this diff adds only the comparison command, implementation and tests.

Independent orchestrator clearance: final head 2ceb421 passes compile, lint and all 190 tests. A dedicated clean npm ci install of the combined checkout passes compile, lint (0 errors; 86 existing warnings) and 286 tests. Current GitHub CI succeeds and the PR is mergeable. Independently verified actual browser geometry: long/short filenames have equal pane origins; all paired row heights match; scrolling synchronizes in both directions and axes; change navigation clears the sticky header exactly; literal HTML remains text. This clears the explicit comparison feature for review, with the native Git/PR integration limitation above retained.

@jonaraphael
jonaraphael marked this pull request as ready for review October 17, 2026 04:47
@jonaraphael
jonaraphael deleted the codex/csv-table-compare branch October 17, 2026 21:13
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