CSV Explorer
A lean VS Code extension that opens .csv and .tsv files as a filterable, sortable table. No runtime dependencies.
Features
- Opens as a table by default for
*.csv and *.tsv. Use Open as Text in the toolbar to switch back to the text editor, or the table icon in the editor title (CSV Explorer: Open as Table) to switch to the table.
- Delimiter detection: comma, tab, semicolon, or pipe. Detection picks the delimiter that gives the most consistent column count over the first 50 rows.
.tsv files prefer tab when it is a tie.
- Per-file delimiter override: the Delimiter dropdown accepts Auto, Comma, Tab, Semicolon, Pipe, or Other… (any single character). VS Code remembers the choice for that file.
- Typed columns are inferred from the non-empty cells:
# number: right-aligned, numeric sort.
✓ boolean: every value is true / false (case-insensitive).
abc text: everything else.
- Column filters sit in the sticky row under the header:
- number:
5 (equals, the default), >5, >=5, <5, <=5, !=5. Text that is not a number falls back to "contains".
- boolean: All / true / false.
- text: case-insensitive contains.
- Shared filter in the toolbar: a case-insensitive contains across all columns (
Ctrl/Cmd+F focuses it). It combines with the column filters (AND).
- Sort: click a column header to cycle ascending → descending → off. Empty cells always sort last.
- Large files: rows are virtualized, so only the visible rows are in the DOM. Filtering 200k rows takes about 10–45 ms.
- The table refreshes live when the file changes. Filters, sort, and scroll position survive switching tabs.
The first row is treated as the header. Quoted fields (RFC 4180) are supported: embedded delimiters, newlines, and "" escapes.
Development
npm install
npm run compile # tsc -> dist/
npm test # unit tests for media/core.js (node:test)
npm run package # build a .vsix
Press F5 in VS Code to launch an Extension Development Host with samples/ open.
Layout
| Path |
Role |
src/extension.ts |
Custom text editor provider. Sends the document text and the delimiter override to the webview. Stores overrides in globalState. |
media/core.js |
Pure logic: CSV parser, delimiter detection, type inference, filter predicates, sort. Shared by the webview and the tests. |
media/main.js |
Webview UI: toolbar, sticky header and filter row, virtualized rows. |
media/style.css |
Minimal styles that use VS Code theme variables. |
| |