Skip to content

feat(inspector): native CSV/TSV document inspector#1306

Merged
datlechin merged 6 commits into
mainfrom
feat/native-csv-inspector
May 17, 2026
Merged

feat(inspector): native CSV/TSV document inspector#1306
datlechin merged 6 commits into
mainfrom
feat/native-csv-inspector

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

Closes #1259.

Adds a native macOS document-based CSV/TSV inspector. Open .csv and .tsv files directly from Finder, drag-and-drop, or File > Open. Each file opens as its own NSDocument-backed window (separate from connection windows, own tab group).

Capabilities

  • Streaming/indexed data layer: memory-mapped file + one-pass quote-aware row index + on-demand single-column decode. Large files (tested with 350 MB / 2M rows) load without copying into memory.
  • Edit cells, undo/redo (single keystroke cell edit = one undo step; bulk delete or paste = one undo step).
  • Multi-condition filter (Cmd+F) with column / operator / value clauses (AND).
  • Multi-column sort via shift-click on column headers, numeric fast path for typed numeric columns, precomputed natural-sort key for text columns ("Item 2" before "Item 10").
  • Filter/sort run on the cooperative thread pool via Task.detached, cancellable on every new request, with an "Updating…" indicator in the status bar.
  • Toolbar: Add Row, Delete, Columns menu (rename / insert before-after / type override / delete), Filter.
  • Copy/paste selected rows as TSV via Cmd+C / Cmd+V.
  • NSFilePresenter: auto-reload when no local edits, sheet prompt when there are unsaved edits. Mtime-based guard prevents self-write feedback loops.
  • Per-document windowFrameAutosaveName so each file remembers its own window position.
  • canConcurrentlyReadDocuments(ofType:) returns true so initial indexing runs off the main thread.

Tests

40 tests in TableProTests/Plugins/CSVInspectorTests.swift + TableProTests/Core/NaturalSortKeyTests.swift covering dialect detection (BOM, delimiter, line ending, encoding), streaming parser (quote handling, RFC 4180 escape, single-column field decode), row store (snapshot, bulk removeRows, column ops), writer round-trip (byte-perfect for unmodified rows, BOM preserved), and natural-sort key semantics (case-insensitive, leading zeros, embedded numbers).

Docs

  • New docs/features/csv-inspector.mdx covering open / edit / column ops / filter / sort / copy-paste / external-change behavior.
  • docs/features/keyboard-shortcuts.mdx updated with Cmd+F, Cmd+C, Cmd+V, and shift-click multi-sort.
  • CHANGELOG.md entry under [Unreleased].

Test plan

  • Open a small CSV from Finder, edit a cell, Cmd+S, reopen, edit persists.
  • Open a 100K+ row CSV, sort by a text column, filter by a value, paginate, verify natural ordering.
  • Open the 350 MB / 2M-row test file from feat: CSV inspection #1259, confirm main thread stays responsive during indexing (window appears after a brief delay, other windows usable).
  • Select rows, Delete (or toolbar -), confirm next row is selected and arrow keys keep navigating.
  • Toolbar Add Row from page 1 of a paginated file: jumps to new row's page with it selected.
  • Columns menu: rename, insert before/after, delete, change type — each one undoable.
  • Cmd+C copies selected rows as TSV (paste into a text editor to verify), Cmd+V from TSV appends new rows.
  • Modify the file in another app while open with no local edits — auto-reloads. With unsaved edits — prompts.

@datlechin datlechin merged commit 01de284 into main May 17, 2026
2 checks passed
@datlechin datlechin deleted the feat/native-csv-inspector branch May 17, 2026 11:02
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.

feat: CSV inspection

1 participant