Skip to content

editor: cap Fit tab width at 400px so long labels truncate - #350299

Draft
Cherry Wang (chryw) wants to merge 1 commit into
mainfrom
dev/cherwan/agents/fix-tab-width-long-names-bug
Draft

Cherry Wang (chryw) wants to merge 1 commit into
mainfrom
dev/cherwan/agents/fix-tab-width-long-names-bug

Conversation

@chryw

Copy link
Copy Markdown
Contributor

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

  • Normal and preview (italic) Fit tabs keep the same widths they have today.
  • shrink and fixed sizing are unchanged and do not inherit the 400px cap; fixed still uses tabSizingFixedMinWidth/tabSizingFixedMaxWidth.
  • Pinned tabs keep their compact/shrink widths.
  • Tab wrapping, Connected and pill tab styles, and Close-button position/reserved space all work with the cap.
  • The full label remains available in the tab's accessible name and hover.

The fit setting description now mentions the 400px maximum.

Before and after

Agents window, Windows remote session, Connected tab style, fit sizing. The before state reapplies the previous Fit CSS in the same session for a matched comparison.

Before: the long tab hides Close behind the editor actions After: the tab stops at 400px and Close is visible
Before: the long filename tab runs under the editor actions with no Close button After: the long filename is truncated with an ellipsis and the Close button is visible

Closing the capped tab directly from its Close button:

issue-348019-remote-windows-close-400px-freshremote400final-raw.webm

How to test

  1. Keep the default workbench.editor.tabSizing (fit) and open a file with a very long name (150+ characters), alongside a few normal files.
  2. The long tab stops at 400px with an ellipsis, its Close button is visible, and hovering the tab shows the full name.
  3. Normal file tabs look the same as before.
  4. Switch to shrink, then fixed: tab widths match today's behavior, and the long tab is not limited to 400px in shrink.
  5. Repeat with workbench.editor.wrapTabs on: 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; pinned compact/shrink widths; and shrink not 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 oxlint on the changed TypeScript files: passed.
  • pnpm run typecheck-client: passed
  • Manual check in Code OSS (Agents window with a mock Windows remote host): the long tab measured 869px before and 400px after, with Close inside the tab and working. Shrink and Fixed widths were unchanged in the same scene.

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>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 03:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

No deployments
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.

Agents window: full Windows path fills editor title and Close button is missing

2 participants