Skip to content

Commit b97d99f

Browse files
Add tabSizingFixedMinWidth setting (microsoft#185766) (microsoft#186058)
* Add tabSizingFixedMinWidth setting (microsoft#185766) * Add forgotten case for wrapping tabs * address feedback --------- Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
1 parent 6f25393 commit b97d99f

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

build/lib/stylelint/vscode-known-variables.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@
706706
"--tab-dirty-border-top-color",
707707
"--tabs-border-bottom-color",
708708
"--tab-sizing-current-width",
709+
"--tab-sizing-fixed-min-width",
709710
"--tab-sizing-fixed-max-width",
710711
"--testMessageDecorationFontFamily",
711712
"--testMessageDecorationFontSize",
@@ -747,4 +748,4 @@
747748
"--z-index-run-button-container",
748749
"--zoom-factor"
749750
]
750-
}
751+
}

src/vs/workbench/browser/parts/editor/editor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const DEFAULT_EDITOR_PART_OPTIONS: IEditorPartOptions = {
2828
highlightModifiedTabs: false,
2929
tabCloseButton: 'right',
3030
tabSizing: 'fit',
31+
tabSizingFixedMinWidth: 50,
3132
tabSizingFixedMaxWidth: 160,
3233
pinnedTabSizing: 'normal',
3334
titleScrollbarSizing: 'default',

src/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
}
125125

126126
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-fixed {
127-
min-width: var(--tab-sizing-current-width, 50px);
127+
min-width: var(--tab-sizing-current-width, var(--tab-sizing-fixed-min-width, 50px));
128128
max-width: var(--tab-sizing-current-width, var(--tab-sizing-fixed-max-width, 160px));
129129
flex: 1 0 0; /* all tabs are evenly sized and grow */
130130
}
@@ -133,7 +133,7 @@
133133
/* prevent last tab in a row from moving to next row when tab widths are
134134
* fixed in case rounding errors make the fixed tabs grow over the size
135135
* of the tabs container */
136-
min-width: calc(var(--tab-sizing-current-width, 50px) - 1px);
136+
min-width: calc(var(--tab-sizing-current-width, var(--tab-sizing-fixed-min-width, 50px)) - 1px);
137137
}
138138

139139
.monaco-workbench .part.editor > .content .editor-group-container > .title > .tabs-and-actions-container.wrapping .tabs-container > .tab.sizing-fit.last-in-row:not(:last-child) {

src/vs/workbench/browser/parts/editor/tabsTitleControl.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ export class TabsTitleControl extends TitleControl {
234234

235235
const options = this.accessor.partOptions;
236236
if (options.tabSizing === 'fixed') {
237+
tabsContainer.style.setProperty('--tab-sizing-fixed-min-width', `${options.tabSizingFixedMinWidth}px`);
237238
tabsContainer.style.setProperty('--tab-sizing-fixed-max-width', `${options.tabSizingFixedMaxWidth}px`);
238239

239240
// For https://github.com/microsoft/vscode/issues/40290 we want to
@@ -249,6 +250,7 @@ export class TabsTitleControl extends TitleControl {
249250
this.updateTabsFixedWidth(false);
250251
}));
251252
} else if (fromEvent) {
253+
tabsContainer.style.removeProperty('--tab-sizing-fixed-min-width');
252254
tabsContainer.style.removeProperty('--tab-sizing-fixed-max-width');
253255
this.updateTabsFixedWidth(false);
254256
}
@@ -721,6 +723,7 @@ export class TabsTitleControl extends TitleControl {
721723

722724
// Update tabs sizing
723725
if (
726+
oldOptions.tabSizingFixedMinWidth !== newOptions.tabSizingFixedMinWidth ||
724727
oldOptions.tabSizingFixedMaxWidth !== newOptions.tabSizingFixedMaxWidth ||
725728
oldOptions.tabSizing !== newOptions.tabSizing
726729
) {

src/vs/workbench/browser/workbench.contribution.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,16 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
150150
],
151151
'markdownDescription': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'tabSizing' }, "Controls the size of editor tabs. This value is ignored when `#workbench.editor.showTabs#` is disabled.")
152152
},
153+
'workbench.editor.tabSizingFixedMinWidth': {
154+
'type': 'number',
155+
'default': 50,
156+
'minimum': 38,
157+
'markdownDescription': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.editor.tabSizingFixedMinWidth' }, "Controls the minimum width of tabs when `#workbench.editor.tabSizing#` size is set to `fixed`.")
158+
},
153159
'workbench.editor.tabSizingFixedMaxWidth': {
154160
'type': 'number',
155161
'default': 160,
156-
'minimum': 50,
162+
'minimum': 38,
157163
'markdownDescription': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.editor.tabSizingFixedMaxWidth' }, "Controls the maximum width of tabs when `#workbench.editor.tabSizing#` size is set to `fixed`.")
158164
},
159165
'workbench.editor.pinnedTabSizing': {

src/vs/workbench/common/editor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,7 @@ interface IEditorPartConfiguration {
10951095
highlightModifiedTabs?: boolean;
10961096
tabCloseButton?: 'left' | 'right' | 'off';
10971097
tabSizing?: 'fit' | 'shrink' | 'fixed';
1098+
tabSizingFixedMinWidth?: number;
10981099
tabSizingFixedMaxWidth?: number;
10991100
pinnedTabSizing?: 'normal' | 'compact' | 'shrink';
11001101
titleScrollbarSizing?: 'default' | 'large';

0 commit comments

Comments
 (0)