fix: fill the pane with the last column and auto-fit worker-backed column widths#5
Merged
sciro24 merged 1 commit intoJul 4, 2026
Conversation
Opening a file whose columns don't fill the editor width — e.g. a 3-column JSONL such as a Codex rollout log (timestamp/type/payload) — showed a blank, headerless "phantom column" after the last real column. This was not a parsing bug and the file was not malformed: the grid parses exactly the right columns. The blank area is unused horizontal space. `.grid-header` and `.grid-row` are full-width flex containers (`.grid-sizer` is `min-width:100%`), so when the fixed-width cells don't fill the row the leftover width still carries the header background and each row's bottom border, which reads as an empty column. Two changes: - DataGrid.svelte: the last visible (non-frozen) column now `flex-grow`s to absorb the leftover width, so the grid always spans the pane with no phantom column. Cells keep `flex-shrink:0` and their px width acts as the flex-basis, so the column only ever grows past its natural width — when columns overflow the pane there is nothing to absorb and horizontal scroll behaves exactly as before. It is pure CSS, so it re-fits on window/pane resize for free and the header and body stay aligned. A frozen last column is skipped because sticky positioning and flex-grow don't combine cleanly. - grid.svelte.ts: worker-backed formats (JSON/Parquet/Arrow/Excel) never populate `_csvAllRows`, so the CSV/raw-rows auto-width pass never ran for them and their columns fell back to type-default widths. Fit column widths once from the first chunk on worker READY so they size to their content like CSV already does. Guarded by a flag (reset on each READY) so filtering or sorting, which re-requests chunk 0, doesn't re-fit. The fill behaviour applies to every file type, so narrow CSVs that previously showed the same trailing gap now fill the pane as well. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
Author
sciro24
reviewed
Jul 4, 2026
sciro24
left a comment
Owner
There was a problem hiding this comment.
Looks good, the grid now fills the available width cleanly and the worker-backed auto-fit makes the initial column sizing much better.
Contributor
Author
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Why this change is needed
Opening a file whose columns don't fill the editor width shows a blank, headerless "phantom column" after the last real column. The easiest repro is a 3-column JSONL — e.g. a Codex rollout log with
timestamp/type/payload— viewed on a normal-width editor.This looks like a parsing bug or a malformed file, but it is neither. The grid parses exactly the right columns (verified: every line of the sample file is valid NDJSON with the same three keys). The blank region is simply unused horizontal space:
.grid-headerand.grid-roware full-width flex containers (.grid-sizerismin-width: 100%).flex-shrink: 0with fixed pixel widths and pack to the left.It is most visible for worker-backed formats (JSON/Parquet/Arrow/Excel): these never received the auto-width pass that CSV gets, so their columns fell back to narrow type-default widths and rarely filled the pane. A wide field like
payloadwas crammed into 160px while a large gap sat to its right.How it was implemented
1. Stretch the last column to fill the pane —
webview-ui/src/components/DataGrid.svelteThe last visible (non-frozen) column now
flex-grows to absorb the leftover width, so the grid always spans the pane with no phantom column. Because cells keepflex-shrink: 0and their pixel width acts as the flex-basis, the column only ever grows past its natural width — when columns overflow the pane there is nothing to absorb and horizontal scrolling behaves exactly as before. It is pure CSS, so it re-fits on window/pane resize for free and the header and body stay aligned automatically. A frozen last column is skipped becauseposition: stickyandflex-growdon't combine cleanly.2. Auto-fit widths for worker-backed formats —
webview-ui/src/stores/grid.svelte.tsJSON/Parquet/Arrow/Excel never populate
_csvAllRows, so the CSV/raw-rows auto-width pass never ran for them. Column widths are now fitted once from the first chunk on workerREADY, so columns size to their content like CSV already does. A flag (reset on eachREADY) guards the pass so filtering or sorting — which re-requests chunk 0 — doesn't re-fit.What it fixes
The fill behavior applies to every file type, so narrow CSVs that previously showed the same trailing gap now fill the pane as well.
Behavior notes
Testing
npm run build(extension + webview) passes; no new warnings..vsixand confirmed both changes are in the shipped bundle (.col-fill { flex-grow: 1 }inmain.css; the auto-width path inmain.js).🤖 Generated with Claude Code