Repository navigation
editor: cap Fit tab width at 400px so long labels truncate - #350299
Draft
Cherry Wang (chryw) wants to merge 1 commit into
Draft
Cherry Wang (chryw) wants to merge 1 commit into
Cherry Wang (chryw) wants to merge 1 commit into
Conversation
With workbench.editor.tabSizing set to fit, a tab always grew to show its full label. An exceptionally long name, such as a long remote path, produced a tab several times wider than the editor and pushed its Close action out of view. Fit tabs now size to their label up to 400px and truncate beyond that with an ellipsis. Normal labels, preview tabs, pinned tab sizing, and the shrink and fixed modes keep their existing widths. Fixes #348019 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change that caps Fit-sized editor tabs at 400px to prevent long labels from crowding out Close.
No open issues 🎉
What changed in this PR
Caps Fit-sized tabs in the shared multi-editor tab control at 400px, so exceptionally long labels truncate instead of expanding indefinitely and crowding out Close.
Changes:
- Adds the width cap and label truncation, including modern tab wrapping rules.
- Updates the Fit setting description and registers the new CSS variable.
- Adds regression coverage for tab styles, preview labels, accessibility, wrapping, Close placement, and unchanged sizing behavior.
No actionable findings remain.
| File | Description |
|---|---|
src/vs/workbench/test/browser/parts/editor/multiEditorTabsControl.test.ts |
Adds cap and compatibility tests; adjusts overflow test widths. |
src/vs/workbench/contrib/modernUI/browser/media/tabs.css |
Preserves the cap when modern tabs wrap. |
src/vs/workbench/browser/workbench.contribution.ts |
Documents the 400px maximum in the Fit setting description. |
src/vs/workbench/browser/parts/editor/media/multieditortabscontrol.css |
Caps Fit tabs and allows long labels to truncate. |
build/lib/stylelint/vscode-known-variables.json |
Registers the Fit maximum-width CSS variable. |
Review effort: Balanced
This branch has not been deployed
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.
Fixes #348019
With the default
workbench.editor.tabSizing: fit, a tab always grows to show its full label. An exceptionally long name, such as a long Windows remote path opened in the Agents window, made one tab several times wider than the editor and pushed its Close button out of view behind the editor actions until you scrolled the tab bar.Fit tabs now size to their label up to 400px and truncate anything longer with an ellipsis, so Close stays visible. Everyday file names are unaffected: 400px comfortably fits normal names, and only exceptionally long labels are capped.
What stays the same
shrinkandfixedsizing are unchanged and do not inherit the 400px cap;fixedstill usestabSizingFixedMinWidth/tabSizingFixedMaxWidth.compact/shrinkwidths.The
fitsetting description now mentions the 400px maximum.Before and after
Agents window, Windows remote session, Connected tab style,
fitsizing. The before state reapplies the previous Fit CSS in the same session for a matched comparison.Closing the capped tab directly from its Close button:
issue-348019-remote-windows-close-400px-freshremote400final-raw.webm
How to test
workbench.editor.tabSizing(fit) and open a file with a very long name (150+ characters), alongside a few normal files.shrink, thenfixed: tab widths match today's behavior, and the long tab is not limited to 400px inshrink.workbench.editor.wrapTabson: the long tab still truncates within the row.Validation
node test/unit/browser/index.js --run src/vs/workbench/test/browser/parts/editor/multiEditorTabsControl.test.ts --browser chromium: 114 passing. New tests cover the 400px cap with truncation across legacy, pill, and Connected styles, wrapping, and Close position/reserved space; unchanged normal/preview widths; preview truncation; pinnedcompact/shrinkwidths; andshrinknot inheriting the cap. Existing tests that used group widths above 400px to force overflow now use smaller widths.node build/stylelint.ts: passed.pnpm run oxlinton the changed TypeScript files: passed.pnpm run typecheck-client: passed