From ec5e091515928cf5c5da927e928e42378bc20307 Mon Sep 17 00:00:00 2001 From: SimonEggert Date: Thu, 17 Jan 2019 00:28:27 +0100 Subject: [PATCH 1/7] Add tabClosingOrder, set default mru and use setting to focus next tab --- .../workbench/browser/parts/editor/editor.ts | 1 + .../browser/parts/editor/tabsTitleControl.ts | 6 +++++ src/vs/workbench/common/editor.ts | 1 + src/vs/workbench/common/editor/editorGroup.ts | 22 +++++++++++++++++-- .../electron-browser/main.contribution.ts | 11 ++++++++++ 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editor.ts b/src/vs/workbench/browser/parts/editor/editor.ts index 2c460e95757f0..afc524bb494d7 100644 --- a/src/vs/workbench/browser/parts/editor/editor.ts +++ b/src/vs/workbench/browser/parts/editor/editor.ts @@ -30,6 +30,7 @@ export const DEFAULT_EDITOR_PART_OPTIONS: IEditorPartOptions = { highlightModifiedTabs: false, tabCloseButton: 'right', tabSizing: 'fit', + tabClosingOrder: 'mru', showIcons: true, enablePreview: true, openPositioning: 'right', diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts index 3f531ff7b4d9f..788d737e1a647 100644 --- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts @@ -385,6 +385,7 @@ export class TabsTitleControl extends TitleControl { oldOptions.labelFormat !== newOptions.labelFormat || oldOptions.tabCloseButton !== newOptions.tabCloseButton || oldOptions.tabSizing !== newOptions.tabSizing || + oldOptions.tabClosingOrder !== newOptions.tabClosingOrder || oldOptions.showIcons !== newOptions.showIcons || oldOptions.iconTheme !== newOptions.iconTheme || oldOptions.highlightModifiedTabs !== newOptions.highlightModifiedTabs @@ -839,6 +840,11 @@ export class TabsTitleControl extends TitleControl { domAction(tabContainer, `sizing-${option}`); }); + ['mru', 'ltr', 'rtl'].forEach(option => { + const domAction = options.tabClosingOrder === option ? addClass : removeClass; + domAction(tabContainer, `closing-tab-order-${option}`); + }); + if (options.showIcons && !!options.iconTheme) { addClass(tabContainer, 'has-icon-theme'); } else { diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index b628d19584b7d..35efdc31b5c38 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -941,6 +941,7 @@ export interface IWorkbenchEditorPartConfiguration { highlightModifiedTabs?: boolean; tabCloseButton?: 'left' | 'right' | 'off'; tabSizing?: 'fit' | 'shrink'; + tabClosingOrder?: 'mru' | 'ltr' | 'rtl'; showIcons?: boolean; enablePreview?: boolean; enablePreviewFromQuickOpen?: boolean; diff --git a/src/vs/workbench/common/editor/editorGroup.ts b/src/vs/workbench/common/editor/editorGroup.ts index 650785bc72002..47bb8f5910c0c 100644 --- a/src/vs/workbench/common/editor/editorGroup.ts +++ b/src/vs/workbench/common/editor/editorGroup.ts @@ -329,10 +329,28 @@ export class EditorGroup extends Disposable { // Active Editor closed if (openNext && this.matches(this.active, editor)) { - // More than one editor if (this.mru.length > 1) { - this.setActive(this.mru[1]); // active editor is always first in MRU, so pick second editor after as new active + const tabClosingOrder = this.configurationService.getValue('workbench.editor.tabClosingOrder'); + if(tabClosingOrder === 'mru') { + this.setActive(this.mru[1]); // active editor is always first in MRU, so pick second editor after as new active + } + else if(tabClosingOrder === 'ltr') { + if (index === this.editors.length -1) { + this.setActive(this.editors[index - 1]); // last editor is closed, pick previous as new active + } + else { + this.setActive(this.editors[index + 1]); // pick next editor as new active + } + } + else { + if (index === 0) { + this.setActive(this.editors[1]); // first editor is closed, pick second as new active + } + else { + this.setActive(this.editors[index - 1]); // pick previous editor as new active + } + } } // One Editor diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index e56dff6c445cf..c83a03f14fe89 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -516,6 +516,17 @@ configurationRegistry.registerConfiguration({ ], 'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'tabSizing' }, "Controls the sizing of editor tabs.") }, + 'workbench.editor.tabClosingOrder': { + 'type': 'string', + 'enum': ['mru', 'ltr', 'rtl'], + 'default': 'mru', + 'enumDescriptions': [ + nls.localize('workbench.editor.tabClosingOrder.mru', "Editor tabs are closed in most recently used order."), + nls.localize('workbench.editor.tabClosingOrder.ltr', "Editor tabs are closed from left to right."), + nls.localize('workbench.editor.tabClosingOrder.rtl', "Editor tabs are closed from right to left.") + ], + 'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'tabClosingOrder' }, "Controls the order in which editor tabs are closed.") + }, 'workbench.editor.showIcons': { 'type': 'boolean', 'description': nls.localize('showIcons', "Controls whether opened editors should show with an icon or not. This requires an icon theme to be enabled as well."), From 5509938f69b6422a5fa15f65f9216774a5da03db Mon Sep 17 00:00:00 2001 From: SimonEggert Date: Thu, 17 Jan 2019 00:50:08 +0100 Subject: [PATCH 2/7] Change domAction name --- src/vs/workbench/browser/parts/editor/tabsTitleControl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts index 788d737e1a647..cc63be32979fa 100644 --- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts @@ -842,7 +842,7 @@ export class TabsTitleControl extends TitleControl { ['mru', 'ltr', 'rtl'].forEach(option => { const domAction = options.tabClosingOrder === option ? addClass : removeClass; - domAction(tabContainer, `closing-tab-order-${option}`); + domAction(tabContainer, `tab-closing-order-${option}`); }); if (options.showIcons && !!options.iconTheme) { From d107a7fc9d3148750dadb1bca164f2d804d85cf2 Mon Sep 17 00:00:00 2001 From: SimonEggert Date: Thu, 17 Jan 2019 02:22:04 +0100 Subject: [PATCH 3/7] Fix formatting --- src/vs/workbench/common/editor/editorGroup.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/common/editor/editorGroup.ts b/src/vs/workbench/common/editor/editorGroup.ts index 47bb8f5910c0c..4ff98253ae810 100644 --- a/src/vs/workbench/common/editor/editorGroup.ts +++ b/src/vs/workbench/common/editor/editorGroup.ts @@ -329,14 +329,15 @@ export class EditorGroup extends Disposable { // Active Editor closed if (openNext && this.matches(this.active, editor)) { + // More than one editor if (this.mru.length > 1) { const tabClosingOrder = this.configurationService.getValue('workbench.editor.tabClosingOrder'); - if(tabClosingOrder === 'mru') { - this.setActive(this.mru[1]); // active editor is always first in MRU, so pick second editor after as new active + if (tabClosingOrder === 'mru') { + this.setActive(this.mru[1]); // active editor is always first in MRU, so pick second editor after as new active } - else if(tabClosingOrder === 'ltr') { - if (index === this.editors.length -1) { + else if (tabClosingOrder === 'ltr') { + if (index === this.editors.length - 1) { this.setActive(this.editors[index - 1]); // last editor is closed, pick previous as new active } else { From e180023fd304a1be664c4e6232003a8278b47d54 Mon Sep 17 00:00:00 2001 From: SimonEggert Date: Thu, 17 Jan 2019 11:11:38 +0100 Subject: [PATCH 4/7] Use mru behavior if no tabClosingOrder is specified --- src/vs/workbench/common/editor/editorGroup.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/common/editor/editorGroup.ts b/src/vs/workbench/common/editor/editorGroup.ts index 4ff98253ae810..0faa272843b00 100644 --- a/src/vs/workbench/common/editor/editorGroup.ts +++ b/src/vs/workbench/common/editor/editorGroup.ts @@ -333,8 +333,13 @@ export class EditorGroup extends Disposable { // More than one editor if (this.mru.length > 1) { const tabClosingOrder = this.configurationService.getValue('workbench.editor.tabClosingOrder'); - if (tabClosingOrder === 'mru') { - this.setActive(this.mru[1]); // active editor is always first in MRU, so pick second editor after as new active + if (tabClosingOrder === 'rtl') { + if (index === 0) { + this.setActive(this.editors[1]); // first editor is closed, pick second as new active + } + else { + this.setActive(this.editors[index - 1]); // pick previous editor as new active + } } else if (tabClosingOrder === 'ltr') { if (index === this.editors.length - 1) { @@ -345,12 +350,7 @@ export class EditorGroup extends Disposable { } } else { - if (index === 0) { - this.setActive(this.editors[1]); // first editor is closed, pick second as new active - } - else { - this.setActive(this.editors[index - 1]); // pick previous editor as new active - } + this.setActive(this.mru[1]); // active editor is always first in MRU, so pick second editor after as new active } } From e37067ddd510b529a599f499e862e3c8d033aca5 Mon Sep 17 00:00:00 2001 From: SimonEggert Date: Thu, 17 Jan 2019 13:02:22 +0100 Subject: [PATCH 5/7] Add tests for ltr and rtl tabClosingOrder --- .../test/common/editor/editorGroups.test.ts | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/src/vs/workbench/test/common/editor/editorGroups.test.ts b/src/vs/workbench/test/common/editor/editorGroups.test.ts index b173955c393a3..1d5d0f8bda256 100644 --- a/src/vs/workbench/test/common/editor/editorGroups.test.ts +++ b/src/vs/workbench/test/common/editor/editorGroups.test.ts @@ -645,6 +645,122 @@ suite('Workbench editor groups', () => { assert.equal(group.count, 0); }); + test('Multiple Editors - closing picks next to the left', function () { + let inst = new TestInstantiationService(); + inst.stub(IStorageService, new TestStorageService()); + inst.stub(ILifecycleService, new TestLifecycleService()); + inst.stub(IWorkspaceContextService, new TestContextService()); + inst.stub(ITelemetryService, NullTelemetryService); + + const config = new TestConfigurationService(); + config.setUserConfiguration('workbench', { editor: { tabClosingOrder: 'rtl' } }); + inst.stub(IConfigurationService, config); + + const group = createGroup(); + const events = groupListener(group); + + const input1 = input(); + const input2 = input(); + const input3 = input(); + const input4 = input(); + const input5 = input(); + + group.openEditor(input1, { pinned: true, active: true }); + group.openEditor(input2, { pinned: true, active: true }); + group.openEditor(input3, { pinned: true, active: true }); + group.openEditor(input4, { pinned: true, active: true }); + group.openEditor(input5, { pinned: true, active: true }); + + assert.equal(group.activeEditor, input5); + assert.equal(group.getEditors(true)[0], input5); + assert.equal(group.count, 5); + + group.closeEditor(input5); + assert.equal(group.activeEditor, input4); + assert.equal(events.activated[5], input4); + assert.equal(group.count, 4); + + group.setActive(input1); + group.closeEditor(input1); + + assert.equal(group.activeEditor, input2); + assert.equal(group.count, 3); + + group.setActive(input3); + group.closeEditor(input3); + + assert.equal(group.activeEditor, input2); + assert.equal(group.count, 2); + + group.closeEditor(input2); + + assert.equal(group.activeEditor, input4); + assert.equal(group.count, 1); + + group.closeEditor(input4); + + assert.ok(!group.activeEditor); + assert.equal(group.count, 0); + }); + + test('Multiple Editors - closing picks next to the right', function () { + let inst = new TestInstantiationService(); + inst.stub(IStorageService, new TestStorageService()); + inst.stub(ILifecycleService, new TestLifecycleService()); + inst.stub(IWorkspaceContextService, new TestContextService()); + inst.stub(ITelemetryService, NullTelemetryService); + + const config = new TestConfigurationService(); + config.setUserConfiguration('workbench', { editor: { tabClosingOrder: 'ltr' } }); + inst.stub(IConfigurationService, config); + + const group = createGroup(); + const events = groupListener(group); + + const input1 = input(); + const input2 = input(); + const input3 = input(); + const input4 = input(); + const input5 = input(); + + group.openEditor(input1, { pinned: true, active: true }); + group.openEditor(input2, { pinned: true, active: true }); + group.openEditor(input3, { pinned: true, active: true }); + group.openEditor(input4, { pinned: true, active: true }); + group.openEditor(input5, { pinned: true, active: true }); + + assert.equal(group.activeEditor, input5); + assert.equal(group.getEditors(true)[0], input5); + assert.equal(group.count, 5); + + group.closeEditor(input5); + assert.equal(group.activeEditor, input4); + assert.equal(events.activated[5], input4); + assert.equal(group.count, 4); + + group.setActive(input1); + group.closeEditor(input1); + + assert.equal(group.activeEditor, input2); + assert.equal(group.count, 3); + + group.setActive(input3); + group.closeEditor(input3); + + assert.equal(group.activeEditor, input4); + assert.equal(group.count, 2); + + group.closeEditor(input4); + + assert.equal(group.activeEditor, input2); + assert.equal(group.count, 1); + + group.closeEditor(input2); + + assert.ok(!group.activeEditor); + assert.equal(group.count, 0); + }); + test('Multiple Editors - move editor', function () { const group = createGroup(); const events = groupListener(group); From ff98172a8addc3e49947dffebe07e2e3b53f8694 Mon Sep 17 00:00:00 2001 From: SimonEggert Date: Thu, 17 Jan 2019 15:26:36 +0100 Subject: [PATCH 6/7] Create group with changed settings to fix tests --- src/vs/workbench/test/common/editor/editorGroups.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/test/common/editor/editorGroups.test.ts b/src/vs/workbench/test/common/editor/editorGroups.test.ts index 1d5d0f8bda256..2f0df14637a91 100644 --- a/src/vs/workbench/test/common/editor/editorGroups.test.ts +++ b/src/vs/workbench/test/common/editor/editorGroups.test.ts @@ -656,7 +656,7 @@ suite('Workbench editor groups', () => { config.setUserConfiguration('workbench', { editor: { tabClosingOrder: 'rtl' } }); inst.stub(IConfigurationService, config); - const group = createGroup(); + const group = inst.createInstance(EditorGroup); const events = groupListener(group); const input1 = input(); @@ -714,7 +714,7 @@ suite('Workbench editor groups', () => { config.setUserConfiguration('workbench', { editor: { tabClosingOrder: 'ltr' } }); inst.stub(IConfigurationService, config); - const group = createGroup(); + const group = inst.createInstance(EditorGroup); const events = groupListener(group); const input1 = input(); From 030e4f9d05e0a9321625664f2ec48bc322d1f025 Mon Sep 17 00:00:00 2001 From: SimonEggert Date: Thu, 17 Jan 2019 20:17:22 +0100 Subject: [PATCH 7/7] Change setting to boolean, remove unneeded code changes, avoid multiple method-calls, only calculate setting when config changes, adjust tests --- .../workbench/browser/parts/editor/editor.ts | 2 +- .../browser/parts/editor/tabsTitleControl.ts | 6 -- src/vs/workbench/common/editor.ts | 2 +- src/vs/workbench/common/editor/editorGroup.ts | 25 ++++---- .../electron-browser/main.contribution.ts | 14 ++--- .../test/common/editor/editorGroups.test.ts | 62 +------------------ 6 files changed, 19 insertions(+), 92 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editor.ts b/src/vs/workbench/browser/parts/editor/editor.ts index afc524bb494d7..09b13c06a1bee 100644 --- a/src/vs/workbench/browser/parts/editor/editor.ts +++ b/src/vs/workbench/browser/parts/editor/editor.ts @@ -30,7 +30,7 @@ export const DEFAULT_EDITOR_PART_OPTIONS: IEditorPartOptions = { highlightModifiedTabs: false, tabCloseButton: 'right', tabSizing: 'fit', - tabClosingOrder: 'mru', + closeTabsInMRUOrder: true, showIcons: true, enablePreview: true, openPositioning: 'right', diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts index cc63be32979fa..3f531ff7b4d9f 100644 --- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts @@ -385,7 +385,6 @@ export class TabsTitleControl extends TitleControl { oldOptions.labelFormat !== newOptions.labelFormat || oldOptions.tabCloseButton !== newOptions.tabCloseButton || oldOptions.tabSizing !== newOptions.tabSizing || - oldOptions.tabClosingOrder !== newOptions.tabClosingOrder || oldOptions.showIcons !== newOptions.showIcons || oldOptions.iconTheme !== newOptions.iconTheme || oldOptions.highlightModifiedTabs !== newOptions.highlightModifiedTabs @@ -840,11 +839,6 @@ export class TabsTitleControl extends TitleControl { domAction(tabContainer, `sizing-${option}`); }); - ['mru', 'ltr', 'rtl'].forEach(option => { - const domAction = options.tabClosingOrder === option ? addClass : removeClass; - domAction(tabContainer, `tab-closing-order-${option}`); - }); - if (options.showIcons && !!options.iconTheme) { addClass(tabContainer, 'has-icon-theme'); } else { diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index 35efdc31b5c38..ae666377dd33f 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -941,7 +941,7 @@ export interface IWorkbenchEditorPartConfiguration { highlightModifiedTabs?: boolean; tabCloseButton?: 'left' | 'right' | 'off'; tabSizing?: 'fit' | 'shrink'; - tabClosingOrder?: 'mru' | 'ltr' | 'rtl'; + closeTabsInMRUOrder?: boolean; showIcons?: boolean; enablePreview?: boolean; enablePreviewFromQuickOpen?: boolean; diff --git a/src/vs/workbench/common/editor/editorGroup.ts b/src/vs/workbench/common/editor/editorGroup.ts index 0faa272843b00..00a275cd8fb71 100644 --- a/src/vs/workbench/common/editor/editorGroup.ts +++ b/src/vs/workbench/common/editor/editorGroup.ts @@ -98,6 +98,7 @@ export class EditorGroup extends Disposable { private active: EditorInput | null; // editor in active state private editorOpenPositioning: 'left' | 'right' | 'first' | 'last'; + private closeTabsInMRUOrder: boolean; constructor( labelOrSerializedGroup: ISerializedEditorGroup, @@ -122,6 +123,7 @@ export class EditorGroup extends Disposable { private onConfigurationUpdated(event?: IConfigurationChangeEvent): void { this.editorOpenPositioning = this.configurationService.getValue('workbench.editor.openPositioning'); + this.closeTabsInMRUOrder = this.configurationService.getValue('workbench.editor.closeTabsInMRUOrder'); } get id(): GroupIdentifier { @@ -332,26 +334,21 @@ export class EditorGroup extends Disposable { // More than one editor if (this.mru.length > 1) { - const tabClosingOrder = this.configurationService.getValue('workbench.editor.tabClosingOrder'); - if (tabClosingOrder === 'rtl') { - if (index === 0) { - this.setActive(this.editors[1]); // first editor is closed, pick second as new active - } - else { - this.setActive(this.editors[index - 1]); // pick previous editor as new active - } + + let newActive: EditorInput; + + if (this.closeTabsInMRUOrder) { + newActive = this.mru[1]; // active editor is always first in MRU, so pick second editor after as new active } - else if (tabClosingOrder === 'ltr') { + else { if (index === this.editors.length - 1) { - this.setActive(this.editors[index - 1]); // last editor is closed, pick previous as new active + newActive = this.editors[index - 1]; // last editor is closed, pick previous as new active } else { - this.setActive(this.editors[index + 1]); // pick next editor as new active + newActive = this.editors[index + 1]; // pick next editor as new active } } - else { - this.setActive(this.mru[1]); // active editor is always first in MRU, so pick second editor after as new active - } + this.setActive(newActive); } // One Editor diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index c83a03f14fe89..02c58fd2585eb 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -516,16 +516,10 @@ configurationRegistry.registerConfiguration({ ], 'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'tabSizing' }, "Controls the sizing of editor tabs.") }, - 'workbench.editor.tabClosingOrder': { - 'type': 'string', - 'enum': ['mru', 'ltr', 'rtl'], - 'default': 'mru', - 'enumDescriptions': [ - nls.localize('workbench.editor.tabClosingOrder.mru', "Editor tabs are closed in most recently used order."), - nls.localize('workbench.editor.tabClosingOrder.ltr', "Editor tabs are closed from left to right."), - nls.localize('workbench.editor.tabClosingOrder.rtl', "Editor tabs are closed from right to left.") - ], - 'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'tabClosingOrder' }, "Controls the order in which editor tabs are closed.") + 'workbench.editor.closeTabsInMRUOrder': { + 'type': 'boolean', + 'description': nls.localize('closeTabsInMRUOrder', "Controls whether tabs are closed in most recently used order."), + 'default': true }, 'workbench.editor.showIcons': { 'type': 'boolean', diff --git a/src/vs/workbench/test/common/editor/editorGroups.test.ts b/src/vs/workbench/test/common/editor/editorGroups.test.ts index 2f0df14637a91..c69335c58be54 100644 --- a/src/vs/workbench/test/common/editor/editorGroups.test.ts +++ b/src/vs/workbench/test/common/editor/editorGroups.test.ts @@ -29,7 +29,7 @@ function inst(): IInstantiationService { inst.stub(ITelemetryService, NullTelemetryService); const config = new TestConfigurationService(); - config.setUserConfiguration('workbench', { editor: { openPositioning: 'right' } }); + config.setUserConfiguration('workbench', { editor: { openPositioning: 'right', closeTabsInMRUOrder: true } }); inst.stub(IConfigurationService, config); return inst; @@ -645,64 +645,6 @@ suite('Workbench editor groups', () => { assert.equal(group.count, 0); }); - test('Multiple Editors - closing picks next to the left', function () { - let inst = new TestInstantiationService(); - inst.stub(IStorageService, new TestStorageService()); - inst.stub(ILifecycleService, new TestLifecycleService()); - inst.stub(IWorkspaceContextService, new TestContextService()); - inst.stub(ITelemetryService, NullTelemetryService); - - const config = new TestConfigurationService(); - config.setUserConfiguration('workbench', { editor: { tabClosingOrder: 'rtl' } }); - inst.stub(IConfigurationService, config); - - const group = inst.createInstance(EditorGroup); - const events = groupListener(group); - - const input1 = input(); - const input2 = input(); - const input3 = input(); - const input4 = input(); - const input5 = input(); - - group.openEditor(input1, { pinned: true, active: true }); - group.openEditor(input2, { pinned: true, active: true }); - group.openEditor(input3, { pinned: true, active: true }); - group.openEditor(input4, { pinned: true, active: true }); - group.openEditor(input5, { pinned: true, active: true }); - - assert.equal(group.activeEditor, input5); - assert.equal(group.getEditors(true)[0], input5); - assert.equal(group.count, 5); - - group.closeEditor(input5); - assert.equal(group.activeEditor, input4); - assert.equal(events.activated[5], input4); - assert.equal(group.count, 4); - - group.setActive(input1); - group.closeEditor(input1); - - assert.equal(group.activeEditor, input2); - assert.equal(group.count, 3); - - group.setActive(input3); - group.closeEditor(input3); - - assert.equal(group.activeEditor, input2); - assert.equal(group.count, 2); - - group.closeEditor(input2); - - assert.equal(group.activeEditor, input4); - assert.equal(group.count, 1); - - group.closeEditor(input4); - - assert.ok(!group.activeEditor); - assert.equal(group.count, 0); - }); - test('Multiple Editors - closing picks next to the right', function () { let inst = new TestInstantiationService(); inst.stub(IStorageService, new TestStorageService()); @@ -711,7 +653,7 @@ suite('Workbench editor groups', () => { inst.stub(ITelemetryService, NullTelemetryService); const config = new TestConfigurationService(); - config.setUserConfiguration('workbench', { editor: { tabClosingOrder: 'ltr' } }); + config.setUserConfiguration('workbench', { editor: { closeTabsInMRUOrder: false } }); inst.stub(IConfigurationService, config); const group = inst.createInstance(EditorGroup);