Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jmannanc committed Sep 11, 2020
1 parent b52a17a commit 3334251
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}

.monaco-workbench .part.editor > .content .editor-group-container > .title.tabs> .tabs-and-actions-container.multi-line-tabs-container > .monaco-scrollable-element > .tabs-container > .tab {
border-bottom: 1px solid rgba(128,128,128,0.2);
flex-grow: 1;
}

.monaco-workbench .part.editor > .content .editor-group-container > .title.tabs > .tabs-and-actions-container > .monaco-scrollable-element {
Expand Down
33 changes: 21 additions & 12 deletions src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,9 @@ export class TabsTitleControl extends TitleControl {
}
}));

this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('workbench.editor.multiLineTabs')) {
const tabsAndActionsContainer = this.tabsAndActionsContainer as HTMLElement;

if (this.configurationService.getValue<boolean>('workbench.editor.multiLineTabs')) {
addClass(tabsAndActionsContainer, 'multi-line-tabs-container');
} else {
removeClass(tabsAndActionsContainer, 'multi-line-tabs-container');
}
this._register(this.accessor.onDidEditorPartOptionsChange(e => {
if (e.oldPartOptions.multiLineTabs !== e.newPartOptions.multiLineTabs) {
this.updateWrappedTabs();
}
}));
}
Expand All @@ -147,8 +141,8 @@ export class TabsTitleControl extends TitleControl {
this.tabsAndActionsContainer = document.createElement('div');
addClass(this.tabsAndActionsContainer, 'tabs-and-actions-container');
this.titleContainer.appendChild(this.tabsAndActionsContainer);
if (this.configurationService.getValue<boolean>('workbench.editor.multiLineTabs')) {
addClass(this.tabsAndActionsContainer, 'multi-line-tabs-container');
if (this.accessor.partOptions.multiLineTabs) {
this.tabsAndActionsContainer.classList.add('multi-line-tabs-container');
}

// Tabs Container
Expand Down Expand Up @@ -202,6 +196,16 @@ export class TabsTitleControl extends TitleControl {
});
}

private updateWrappedTabs(): void {
const tabsAndActionsContainer = this.tabsAndActionsContainer as HTMLElement;

if (this.accessor.partOptions.multiLineTabs) {
tabsAndActionsContainer.classList.add('multi-line-tabs-container');
} else {
tabsAndActionsContainer.classList.remove('multi-line-tabs-container');
}
}

private getTabsScrollbarSizing(): number {
if (this.accessor.partOptions.titleScrollbarSizing !== 'large') {
return TabsTitleControl.SCROLLBAR_SIZES.default;
Expand Down Expand Up @@ -542,7 +546,8 @@ export class TabsTitleControl extends TitleControl {
oldOptions.pinnedTabSizing !== newOptions.pinnedTabSizing ||
oldOptions.showIcons !== newOptions.showIcons ||
oldOptions.hasIcons !== newOptions.hasIcons ||
oldOptions.highlightModifiedTabs !== newOptions.highlightModifiedTabs
oldOptions.highlightModifiedTabs !== newOptions.highlightModifiedTabs ||
oldOptions.multiLineTabs !== newOptions.multiLineTabs
) {
this.redraw();
}
Expand Down Expand Up @@ -1057,6 +1062,10 @@ export class TabsTitleControl extends TitleControl {
const borderRightColor = ((isTabLastSticky ? this.getColor(TAB_LAST_PINNED_BORDER) : undefined) || this.getColor(TAB_BORDER) || this.getColor(contrastBorder));
tabContainer.style.borderRight = borderRightColor ? `1px solid ${borderRightColor}` : '';
tabContainer.style.outlineColor = this.getColor(activeContrastBorder) || '';
// Add a border to the bottom of the tabs if multi-line tabs is enabled
if (this.accessor.partOptions.multiLineTabs) {
tabContainer.style.borderBottom = `1px solid ${borderRightColor}`;
}

// Settings
const tabActionsVisibility = isTabSticky && options.pinnedTabSizing === 'compact' ? 'off' /* treat sticky compact tabs as tabCloseButton: 'off' */ : options.tabCloseButton;
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/common/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,7 @@ interface IEditorPartConfiguration {
value?: number;
perEditorGroup?: boolean;
};
multiLineTabs?: boolean;
}

export interface IEditorPartOptions extends IEditorPartConfiguration {
Expand Down

0 comments on commit 3334251

Please sign in to comment.