diff --git a/src/vs/workbench/browser/actions/quickAccessActions.ts b/src/vs/workbench/browser/actions/quickAccessActions.ts index 2f369a77572..0295a2580ff 100644 --- a/src/vs/workbench/browser/actions/quickAccessActions.ts +++ b/src/vs/workbench/browser/actions/quickAccessActions.ts @@ -151,7 +151,7 @@ CommandsRegistry.registerCommand({ } }); -CommandsRegistry.registerCommand('workbench.action.quickOpenPreviousEditor', async function (accessor: ServicesAccessor, prefix: string | null = null) { +CommandsRegistry.registerCommand('workbench.action.quickOpenPreviousEditor', async accessor => { const quickInputService = accessor.get(IQuickInputService); quickInputService.quickAccess.show('', { itemActivation: ItemActivation.SECOND }); diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts index f80f1ff03be..5e03ab84808 100644 --- a/src/vs/workbench/browser/parts/editor/editorActions.ts +++ b/src/vs/workbench/browser/parts/editor/editorActions.ts @@ -1339,7 +1339,8 @@ export class QuickAccessPreviousEditorFromHistoryAction extends Action { id: string, label: string, @IQuickInputService private readonly quickInputService: IQuickInputService, - @IKeybindingService private readonly keybindingService: IKeybindingService + @IKeybindingService private readonly keybindingService: IKeybindingService, + @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService ) { super(id, label); } @@ -1347,7 +1348,14 @@ export class QuickAccessPreviousEditorFromHistoryAction extends Action { async run(): Promise { const keybindings = this.keybindingService.lookupKeybindings(this.id); - this.quickInputService.quickAccess.show('', { quickNavigateConfiguration: { keybindings } }); + // Enforce to activate the first item in quick access if + // the currently active editor group has n editor opened + let itemActivation: ItemActivation | undefined = undefined; + if (this.editorGroupService.activeGroup.count === 0) { + itemActivation = ItemActivation.FIRST; + } + + this.quickInputService.quickAccess.show('', { quickNavigateConfiguration: { keybindings }, itemActivation }); } }