diff --git a/src/vs/base/browser/ui/splitview/splitview.ts b/src/vs/base/browser/ui/splitview/splitview.ts index 5f6cbe73e3e..e6eaeae6bdc 100644 --- a/src/vs/base/browser/ui/splitview/splitview.ts +++ b/src/vs/base/browser/ui/splitview/splitview.ts @@ -462,6 +462,7 @@ export class SplitView extends Disposable { this.distributeEmptySpace(index); this.layoutViews(); + this.saveProportions(); } getViewCachedVisibleSize(index: number): number | undefined { diff --git a/src/vs/base/test/browser/ui/grid/grid.test.ts b/src/vs/base/test/browser/ui/grid/grid.test.ts index 3c2b1b4ec44..25468a06bb9 100644 --- a/src/vs/base/test/browser/ui/grid/grid.test.ts +++ b/src/vs/base/test/browser/ui/grid/grid.test.ts @@ -834,6 +834,24 @@ suite('SerializableGrid', function () { assert.deepEqual(view4.size, [200, 200]); assert.deepEqual(view5.size, [600, 0]); + grid.setViewVisible(view5, true); + + assert.deepEqual(view1.size, [600, 300]); + assert.deepEqual(view2.size, [600, 200]); + assert.deepEqual(view3.size, [200, 400]); + assert.deepEqual(view4.size, [200, 200]); + assert.deepEqual(view5.size, [600, 100]); + + grid.setViewVisible(view5, false); + + assert.deepEqual(view1.size, [600, 400]); + assert.deepEqual(view2.size, [600, 200]); + assert.deepEqual(view3.size, [200, 400]); + assert.deepEqual(view4.size, [200, 200]); + assert.deepEqual(view5.size, [600, 0]); + + grid.setViewVisible(view5, false); + const json = grid.serialize(); assert.deepEqual(json, { orientation: 0, diff --git a/src/vs/editor/contrib/suggest/suggestMemory.ts b/src/vs/editor/contrib/suggest/suggestMemory.ts index f8997401fde..d08685206be 100644 --- a/src/vs/editor/contrib/suggest/suggestMemory.ts +++ b/src/vs/editor/contrib/suggest/suggestMemory.ts @@ -22,10 +22,10 @@ export abstract class Memory { if (items.length === 0) { return 0; } - let topScore = items[0].score; + let topScore = items[0].score[0]; for (let i = 1; i < items.length; i++) { const { score, completion: suggestion } = items[i]; - if (score !== topScore) { + if (score[0] !== topScore) { // stop when leaving the group of top matches break; } @@ -81,33 +81,42 @@ export class LRUMemory extends Memory { } select(model: ITextModel, pos: IPosition, items: CompletionItem[]): number { - // in order of completions, select the first - // that has been used in the past - let { word } = model.getWordUntilPosition(pos); - if (word.length !== 0) { - return super.select(model, pos, items); + + if (items.length === 0) { + return 0; } - let lineSuffix = model.getLineContent(pos.lineNumber).substr(pos.column - 10, pos.column - 1); + const lineSuffix = model.getLineContent(pos.lineNumber).substr(pos.column - 10, pos.column - 1); if (/\s$/.test(lineSuffix)) { return super.select(model, pos, items); } - let res = -1; + let topScore = items[0].score[0]; + let indexPreselect = -1; + let indexRecency = -1; let seq = -1; for (let i = 0; i < items.length; i++) { - const { completion: suggestion } = items[i]; - const key = `${model.getLanguageIdentifier().language}/${suggestion.label}`; - const item = this._cache.get(key); - if (item && item.touch > seq && item.type === suggestion.kind && item.insertText === suggestion.insertText) { + if (items[i].score[0] !== topScore) { + // consider only top items + break; + } + const key = `${model.getLanguageIdentifier().language}/${items[i].completion.label}`; + const item = this._cache.peek(key); + if (item && item.touch > seq && item.type === items[i].completion.kind && item.insertText === items[i].completion.insertText) { seq = item.touch; - res = i; + indexRecency = i; + } + if (items[i].completion.preselect && indexPreselect === -1) { + // stop when seeing an auto-select-item + return indexPreselect = i; } } - if (res === -1) { - return super.select(model, pos, items); + if (indexRecency !== -1) { + return indexRecency; + } else if (indexPreselect !== -1) { + return indexPreselect; } else { - return res; + return 0; } } diff --git a/src/vs/editor/contrib/suggest/test/suggestMemory.test.ts b/src/vs/editor/contrib/suggest/test/suggestMemory.test.ts index 3dda6f9f6fb..fd2ee8ec49c 100644 --- a/src/vs/editor/contrib/suggest/test/suggestMemory.test.ts +++ b/src/vs/editor/contrib/suggest/test/suggestMemory.test.ts @@ -101,6 +101,29 @@ suite('SuggestMemories', function () { ]), 0); }); + test('`"editor.suggestSelection": "recentlyUsed"` should be a little more sticky #78571', function () { + + let item1 = createSuggestItem('gamma', 0); + let item2 = createSuggestItem('game', 0); + items = [item1, item2]; + + let mem = new LRUMemory(); + buffer.setValue(' foo.'); + mem.memorize(buffer, { lineNumber: 1, column: 1 }, item2); + + assert.equal(mem.select(buffer, { lineNumber: 1, column: 2 }, items), 0); // leading whitespace -> ignore recent items + + mem.memorize(buffer, { lineNumber: 1, column: 9 }, item2); + assert.equal(mem.select(buffer, { lineNumber: 1, column: 9 }, items), 1); // foo. + + buffer.setValue(' foo.g'); + assert.equal(mem.select(buffer, { lineNumber: 1, column: 10 }, items), 1); // foo.g, 'gamma' and 'game' have the same score + + item1.score = [10, 0, 0]; + assert.equal(mem.select(buffer, { lineNumber: 1, column: 10 }, items), 0); // foo.g, 'gamma' has higher score + + }); + test('intellisense is not showing top options first #43429', function () { // ensure we don't memorize for whitespace prefixes diff --git a/src/vs/workbench/api/common/extHostWorkspace.ts b/src/vs/workbench/api/common/extHostWorkspace.ts index 60430507428..d217d63b4d6 100644 --- a/src/vs/workbench/api/common/extHostWorkspace.ts +++ b/src/vs/workbench/api/common/extHostWorkspace.ts @@ -294,7 +294,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac this._unconfirmedWorkspace = undefined; // show error to user - this._messageService.$showMessage(Severity.Error, localize('updateerror', "Extension '{0}' failed to update workspace folders: {1}", extName, error), { extension }, []); + this._messageService.$showMessage(Severity.Error, localize('updateerror', "Extension '{0}' failed to update workspace folders: {1}", extName, error.toString()), { extension }, []); }); } diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index 354ef330025..31daf2483f5 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -36,7 +36,7 @@ import { SplitEditorUpAction, SplitEditorDownAction, MoveEditorToLeftGroupAction, MoveEditorToRightGroupAction, MoveEditorToAboveGroupAction, MoveEditorToBelowGroupAction, CloseAllEditorGroupsAction, JoinAllGroupsAction, FocusLeftGroup, FocusAboveGroup, FocusRightGroup, FocusBelowGroup, EditorLayoutSingleAction, EditorLayoutTwoColumnsAction, EditorLayoutThreeColumnsAction, EditorLayoutTwoByTwoGridAction, EditorLayoutTwoRowsAction, EditorLayoutThreeRowsAction, EditorLayoutTwoColumnsBottomAction, EditorLayoutTwoRowsRightAction, NewEditorGroupLeftAction, NewEditorGroupRightAction, - NewEditorGroupAboveAction, NewEditorGroupBelowAction, SplitEditorOrthogonalAction, CloseEditorInAllGroupsAction, NavigateToLastEditLocationAction + NewEditorGroupAboveAction, NewEditorGroupBelowAction, SplitEditorOrthogonalAction, CloseEditorInAllGroupsAction, NavigateToLastEditLocationAction, ToggleGroupSizesAction } from 'vs/workbench/browser/parts/editor/editorActions'; import * as editorCommands from 'vs/workbench/browser/parts/editor/editorCommands'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -334,6 +334,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(JoinTwoGroupsAction, J registry.registerWorkbenchAction(new SyncActionDescriptor(JoinAllGroupsAction, JoinAllGroupsAction.ID, JoinAllGroupsAction.LABEL), 'View: Join All Editor Groups', category); registry.registerWorkbenchAction(new SyncActionDescriptor(NavigateBetweenGroupsAction, NavigateBetweenGroupsAction.ID, NavigateBetweenGroupsAction.LABEL), 'View: Navigate Between Editor Groups', category); registry.registerWorkbenchAction(new SyncActionDescriptor(ResetGroupSizesAction, ResetGroupSizesAction.ID, ResetGroupSizesAction.LABEL), 'View: Reset Editor Group Sizes', category); +registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleGroupSizesAction, ToggleGroupSizesAction.ID, ToggleGroupSizesAction.LABEL), 'View: Toggle Editor Group Sizes', category); registry.registerWorkbenchAction(new SyncActionDescriptor(MaximizeGroupAction, MaximizeGroupAction.ID, MaximizeGroupAction.LABEL), 'View: Maximize Editor Group and Hide Side Bar', category); registry.registerWorkbenchAction(new SyncActionDescriptor(MinimizeOtherGroupsAction, MinimizeOtherGroupsAction.ID, MinimizeOtherGroupsAction.LABEL), 'View: Maximize Editor Group', category); registry.registerWorkbenchAction(new SyncActionDescriptor(MoveEditorLeftInGroupAction, MoveEditorLeftInGroupAction.ID, MoveEditorLeftInGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.PageUp, mac: { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.LeftArrow) } }), 'View: Move Editor Left', category); diff --git a/src/vs/workbench/browser/parts/editor/editor.ts b/src/vs/workbench/browser/parts/editor/editor.ts index f36234ec441..5a56c61b3f0 100644 --- a/src/vs/workbench/browser/parts/editor/editor.ts +++ b/src/vs/workbench/browser/parts/editor/editor.ts @@ -109,6 +109,9 @@ export interface IEditorGroupView extends IDisposable, ISerializableView, IEdito readonly whenRestored: Promise; readonly disposed: boolean; + readonly isEmpty: boolean; + readonly isMinimized: boolean; + readonly onDidFocus: Event; readonly onWillDispose: Event; readonly onWillOpenEditor: Event; @@ -116,7 +119,6 @@ export interface IEditorGroupView extends IDisposable, ISerializableView, IEdito readonly onWillCloseEditor: Event; readonly onDidCloseEditor: Event; - isEmpty(): boolean; setActive(isActive: boolean): void; notifyIndexChanged(newIndex: number): void; diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts index ba90f283b0a..0464d3131be 100644 --- a/src/vs/workbench/browser/parts/editor/editorActions.ts +++ b/src/vs/workbench/browser/parts/editor/editorActions.ts @@ -880,6 +880,22 @@ export class ResetGroupSizesAction extends Action { } } +export class ToggleGroupSizesAction extends Action { + + static readonly ID = 'workbench.action.toggleEditorWidths'; + static readonly LABEL = nls.localize('toggleEditorWidths', "Toggle Editor Group Sizes"); + + constructor(id: string, label: string, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService) { + super(id, label); + } + + run(): Promise { + this.editorGroupService.arrangeGroups(GroupsArrangement.TOGGLE); + + return Promise.resolve(false); + } +} + export class MaximizeGroupAction extends Action { static readonly ID = 'workbench.action.maximizeEditor'; diff --git a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts index 266f09275db..97cabc264b6 100644 --- a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts +++ b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts @@ -409,7 +409,7 @@ class DropOverlay extends Themable { } private getOverlayOffsetHeight(): number { - if (!this.groupView.isEmpty() && this.accessor.partOptions.showTabs) { + if (!this.groupView.isEmpty && this.accessor.partOptions.showTabs) { return EDITOR_TITLE_HEIGHT; // show overlay below title if group shows tabs } diff --git a/src/vs/workbench/browser/parts/editor/editorGroupView.ts b/src/vs/workbench/browser/parts/editor/editorGroupView.ts index 6f575845305..bbf73ff14da 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupView.ts @@ -250,7 +250,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { // Open new file via doubleclick on empty container this._register(addDisposableListener(this.element, EventType.DBLCLICK, e => { - if (this.isEmpty()) { + if (this.isEmpty) { EventHelper.stop(e); this.openEditor(this.untitledEditorService.createOrGet(), EditorOptions.create({ pinned: true })); @@ -259,7 +259,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { // Close empty editor group via middle mouse click this._register(addDisposableListener(this.element, EventType.MOUSE_UP, e => { - if (this.isEmpty() && e.button === 1 /* Middle Button */) { + if (this.isEmpty && e.button === 1 /* Middle Button */) { EventHelper.stop(e); this.accessor.removeGroup(this); @@ -308,7 +308,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { } private onShowContainerContextMenu(menu: IMenu, e?: MouseEvent): void { - if (!this.isEmpty()) { + if (!this.isEmpty) { return; // only for empty editor groups } @@ -339,7 +339,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { // Container const containerFocusTracker = this._register(trackFocus(this.element)); this._register(containerFocusTracker.onDidFocus(() => { - if (this.isEmpty()) { + if (this.isEmpty) { this._onDidFocus.fire(); // only when empty to prevent accident focus } })); @@ -381,7 +381,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { private updateContainer(): void { // Empty Container: add some empty container attributes - if (this.isEmpty()) { + if (this.isEmpty) { addClass(this.element, 'empty'); this.element.tabIndex = 0; this.element.setAttribute('aria-label', localize('emptyEditorGroup', "{0} (empty)", this.label)); @@ -672,6 +672,18 @@ export class EditorGroupView extends Themable implements IEditorGroupView { return this._whenRestored; } + get isEmpty(): boolean { + return this._group.count === 0; + } + + get isMinimized(): boolean { + if (!this.dimension) { + return false; + } + + return this.dimension.width === this.minimumWidth || this.dimension.height === this.minimumHeight; + } + notifyIndexChanged(newIndex: number): void { if (this._index !== newIndex) { this._index = newIndex; @@ -696,10 +708,6 @@ export class EditorGroupView extends Themable implements IEditorGroupView { this._onDidGroupChange.fire({ kind: GroupChangeKind.GROUP_ACTIVE }); } - isEmpty(): boolean { - return this._group.count === 0; - } - //#endregion //#region IEditorGroup @@ -1224,7 +1232,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { //#region closeEditors() async closeEditors(args: EditorInput[] | ICloseEditorsFilter, options?: ICloseEditorOptions): Promise { - if (this.isEmpty()) { + if (this.isEmpty) { return; } @@ -1296,7 +1304,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { //#region closeAllEditors() async closeAllEditors(): Promise { - if (this.isEmpty()) { + if (this.isEmpty) { // If the group is empty and the request is to close all editors, we still close // the editor group is the related setting to close empty groups is enabled for @@ -1408,7 +1416,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { //#region Themable protected updateStyles(): void { - const isEmpty = this.isEmpty(); + const isEmpty = this.isEmpty; // Container if (isEmpty) { diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index df41417a615..4dc5c4a28ad 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -346,15 +346,36 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro return; // we have not been created yet } - // Even all group sizes - if (arrangement === GroupsArrangement.EVEN) { - this.gridWidget.distributeViewSizes(); + switch (arrangement) { + case GroupsArrangement.EVEN: + this.gridWidget.distributeViewSizes(); + break; + case GroupsArrangement.MINIMIZE_OTHERS: + this.gridWidget.maximizeViewSize(this.activeGroup); + break; + case GroupsArrangement.TOGGLE: + if (this.isGroupMaximized(this.activeGroup)) { + this.arrangeGroups(GroupsArrangement.EVEN); + } else { + this.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS); + } + + break; + } + } + + private isGroupMaximized(targetGroup: IEditorGroupView): boolean { + for (const group of this.groups) { + if (group === targetGroup) { + continue; // ignore target group + } + + if (!group.isMinimized) { + return false; // target cannot be maximized if one group is not minimized + } } - // Maximize the current active group - else { - this.gridWidget.maximizeViewSize(this.activeGroup); - } + return true; } setGroupOrientation(orientation: GroupOrientation): void { @@ -604,7 +625,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro } // Remove empty group - if (groupView.isEmpty()) { + if (groupView.isEmpty) { return this.doRemoveEmptyGroup(groupView); } @@ -722,7 +743,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro }); // Remove source if the view is now empty and not already removed - if (sourceView.isEmpty() && !sourceView.disposed /* could have been disposed already via workbench.editor.closeEmptyGroups setting */) { + if (sourceView.isEmpty && !sourceView.disposed /* could have been disposed already via workbench.editor.closeEmptyGroups setting */) { this.removeGroup(sourceView); } @@ -925,7 +946,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro } private isEmpty(): boolean { - return this.groupViews.size === 1 && this._activeGroup.isEmpty(); + return this.groupViews.size === 1 && this._activeGroup.isEmpty; } layout(width: number, height: number): void { @@ -957,7 +978,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro mostRecentActiveGroups: this.mostRecentActiveGroups }; - if (this.isEmpty()) { + if (this.isEmpty) { delete this.workspaceMemento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY]; } else { this.workspaceMemento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY] = uiState; diff --git a/src/vs/workbench/services/editor/common/editorGroupsService.ts b/src/vs/workbench/services/editor/common/editorGroupsService.ts index 6c9a974e6ea..a53e5ce507e 100644 --- a/src/vs/workbench/services/editor/common/editorGroupsService.ts +++ b/src/vs/workbench/services/editor/common/editorGroupsService.ts @@ -59,7 +59,13 @@ export const enum GroupsArrangement { /** * Size all groups evenly. */ - EVEN + EVEN, + + /** + * Will behave like MINIMIZE_OTHERS if the active + * group is not already maximized and EVEN otherwise + */ + TOGGLE } export interface GroupLayoutArgument { diff --git a/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts b/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts index c09e9aaf1e7..d461e545ddc 100644 --- a/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts +++ b/src/vs/workbench/services/editor/test/browser/editorGroupsService.test.ts @@ -388,7 +388,7 @@ suite('EditorGroupsService', () => { test('editor basics', async function () { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); await part.whenRestored; @@ -437,7 +437,7 @@ suite('EditorGroupsService', () => { assert.equal(group.isActive(inputInactive), false); assert.equal(group.isOpened(input), true); assert.equal(group.isOpened(inputInactive), true); - assert.equal(group.isEmpty(), false); + assert.equal(group.isEmpty, false); assert.equal(group.count, 2); assert.equal(editorWillOpenCounter, 2); assert.equal(editorDidOpenCounter, 2); @@ -486,7 +486,7 @@ suite('EditorGroupsService', () => { test('openEditors / closeEditors', async () => { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); @@ -497,14 +497,14 @@ suite('EditorGroupsService', () => { assert.equal(group.getEditor(1), inputInactive); await group.closeEditors([input, inputInactive]); - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); part.dispose(); }); test('closeEditors (except one)', async () => { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); const input1 = new TestEditorInput(URI.file('foo/bar1')); const input2 = new TestEditorInput(URI.file('foo/bar2')); @@ -525,7 +525,7 @@ suite('EditorGroupsService', () => { test('closeEditors (saved only)', async () => { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); const input1 = new TestEditorInput(URI.file('foo/bar1')); const input2 = new TestEditorInput(URI.file('foo/bar2')); @@ -545,7 +545,7 @@ suite('EditorGroupsService', () => { test('closeEditors (direction: right)', async () => { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); const input1 = new TestEditorInput(URI.file('foo/bar1')); const input2 = new TestEditorInput(URI.file('foo/bar2')); @@ -567,7 +567,7 @@ suite('EditorGroupsService', () => { test('closeEditors (direction: left)', async () => { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); const input1 = new TestEditorInput(URI.file('foo/bar1')); const input2 = new TestEditorInput(URI.file('foo/bar2')); @@ -589,7 +589,7 @@ suite('EditorGroupsService', () => { test('closeAllEditors', async () => { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); @@ -600,14 +600,14 @@ suite('EditorGroupsService', () => { assert.equal(group.getEditor(1), inputInactive); await group.closeAllEditors(); - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); part.dispose(); }); test('moveEditor (same group)', async () => { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); @@ -635,7 +635,7 @@ suite('EditorGroupsService', () => { test('moveEditor (across groups)', async () => { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); const rightGroup = part.addGroup(group, GroupDirection.RIGHT); @@ -657,7 +657,7 @@ suite('EditorGroupsService', () => { test('copyEditor (across groups)', async () => { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); const rightGroup = part.addGroup(group, GroupDirection.RIGHT); @@ -680,7 +680,7 @@ suite('EditorGroupsService', () => { test('replaceEditors', async () => { const part = createPart(); const group = part.activeGroup; - assert.equal(group.isEmpty(), true); + assert.equal(group.isEmpty, true); const input = new TestEditorInput(URI.file('foo/bar')); const inputInactive = new TestEditorInput(URI.file('foo/bar/inactive')); diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index 3bebf0fa5a9..0ca22ba62b8 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -770,6 +770,9 @@ export class TestEditorGroup implements IEditorGroupView { minimumHeight: number; maximumHeight: number; + isEmpty = true; + isMinimized = false; + onWillDispose: Event = Event.None; onDidGroupChange: Event = Event.None; onWillCloseEditor: Event = Event.None; @@ -839,7 +842,6 @@ export class TestEditorGroup implements IEditorGroupView { throw new Error('not implemented'); } - isEmpty(): boolean { return true; } setActive(_isActive: boolean): void { } notifyIndexChanged(_index: number): void { } dispose(): void { }