提交 9fa09884 编写于 作者: B Benjamin Pasero

more tab layout tweaks

上级 6bc5a14b
......@@ -228,6 +228,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
private updateTabOptions(tabOptions: IEditorTabOptions, refresh?: boolean): void {
const tabCloseButton = this.tabOptions ? this.tabOptions.tabCloseButton : 'right';
const tabSizing = this.tabOptions ? this.tabOptions.tabSizing : 'fit';
const iconTheme = this.tabOptions ? this.tabOptions.iconTheme : 'vs-seti';
this.tabOptions = tabOptions;
......@@ -266,7 +267,12 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
}
// Refresh title when layout options change
else if (showingIcons !== this.tabOptions.showIcons || tabCloseButton !== this.tabOptions.tabCloseButton || tabSizing !== this.tabOptions.tabSizing) {
else if (
showingIcons !== this.tabOptions.showIcons ||
tabCloseButton !== this.tabOptions.tabCloseButton ||
tabSizing !== this.tabOptions.tabSizing ||
iconTheme !== this.tabOptions.iconTheme
) {
titleControl.refresh();
}
}
......
......@@ -164,6 +164,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
tabCloseButton: editorConfig.tabCloseButton,
tabSizing: editorConfig.tabSizing,
labelFormat: editorConfig.labelFormat,
iconTheme: config.workbench.iconTheme
};
this.revealIfOpen = editorConfig.revealIfOpen;
......@@ -175,6 +176,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
tabCloseButton: 'right',
tabSizing: 'fit',
labelFormat: 'default',
iconTheme: 'vs-seti'
};
this.revealIfOpen = false;
......@@ -207,7 +209,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
private onConfigurationUpdated(event: IConfigurationChangeEvent): void {
if (event.affectsConfiguration('workbench.editor')) {
if (event.affectsConfiguration('workbench.editor') || event.affectsConfiguration('workbench.iconTheme')) {
const configuration = this.configurationService.getValue<IWorkbenchEditorConfiguration>();
if (configuration && configuration.workbench && configuration.workbench.editor) {
const editorConfig = configuration.workbench.editor;
......@@ -230,6 +232,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
tabSizing: editorConfig.tabSizing,
showTabs: this.forceHideTabs ? false : editorConfig.showTabs,
labelFormat: editorConfig.labelFormat,
iconTheme: configuration.workbench.iconTheme
};
if (!this.doNotFireTabOptionsChanged && !objects.equals(oldTabOptions, this.tabOptions)) {
......
......@@ -45,6 +45,11 @@
padding-left: 10px;
}
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.sizing-shrink.has-icon-theme.close-button-right,
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.sizing-shrink.has-icon-theme.close-button-off {
padding-left: 5px; /* reduce padding when we show icons and are in shrinking mode and tab close button is not left */
}
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.sizing-fit {
width: 120px;
min-width: fit-content;
......@@ -160,11 +165,7 @@
/* No Tab Close Button */
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.close-button-off {
padding-right: 12px; /* give a little bit more room if close button is off... */
}
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.close-button-off.sizing-shrink {
padding-right: 0; /* ...but not when shrinking is enabled */
padding-right: 10px; /* give a little bit more room if close button is off */
}
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab.close-button-off.dirty {
......
......@@ -324,6 +324,12 @@ export class TabsTitleControl extends TitleControl {
domAction(tabContainer, `sizing-${option}`);
});
if (tabOptions.showIcons && !!tabOptions.iconTheme) {
DOM.addClass(tabContainer, 'has-icon-theme');
} else {
DOM.removeClass(tabContainer, 'has-icon-theme');
}
// Label
const tabLabel = this.editorLabels[index];
tabLabel.setLabel({ name, description, resource: toResource(editor, { supportSideBySide: true }) }, { extraClasses: ['tab-label'], italic: !isPinned });
......
......@@ -821,7 +821,8 @@ export interface IWorkbenchEditorConfiguration {
revealIfOpen: boolean;
swipeToNavigate: boolean,
labelFormat: 'default' | 'short' | 'medium' | 'long';
}
},
iconTheme: string;
};
}
......
......@@ -26,6 +26,7 @@ export interface IEditorTabOptions {
showIcons?: boolean;
previewEditors?: boolean;
labelFormat?: 'default' | 'short' | 'medium' | 'long';
iconTheme?: string;
}
export interface IMoveOptions {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册