diff --git a/src/vs/platform/editor/common/editor.ts b/src/vs/platform/editor/common/editor.ts index 53a914af1f981..bb6005008c593 100644 --- a/src/vs/platform/editor/common/editor.ts +++ b/src/vs/platform/editor/common/editor.ts @@ -235,6 +235,13 @@ export interface IEditorOptions { */ revealIfOpened?: boolean; + /** + * Controls whether editors opened from Quick Open will always open in the currently active editor group. + * Similar to setting the 'revealIfOpened' setting to false, this will open multiple copies of an editor in + * different editor groups. + */ + alwaysOpenInActiveGroupFromQuickOpen?: boolean; + /** * An editor that is pinned remains in the editor stack even when another editor is being opened. * An editor that is not pinned will always get replaced by another editor that is not pinned. diff --git a/src/vs/workbench/browser/parts/editor/editorQuickAccess.ts b/src/vs/workbench/browser/parts/editor/editorQuickAccess.ts index b421e11c53220..ce8196f20d318 100644 --- a/src/vs/workbench/browser/parts/editor/editorQuickAccess.ts +++ b/src/vs/workbench/browser/parts/editor/editorQuickAccess.ts @@ -179,7 +179,13 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro return TriggerAction.NO_ACTION; }, - accept: (keyMods, event) => this.editorGroupService.getGroup(groupId)?.openEditor(editor, { preserveFocus: event.inBackground }), + accept: (keyMods, event) => { + if (this.editorGroupService.partOptions.alwaysOpenInActiveGroupFromQuickOpen) { + this.editorGroupService.activeGroup?.openEditor(editor, { preserveFocus: event.inBackground }); + } else { + this.editorGroupService.getGroup(groupId)?.openEditor(editor, { preserveFocus: event.inBackground }); + } + }, }; }); } diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts index 000fd151ee265..fe58af9452fc8 100644 --- a/src/vs/workbench/browser/workbench.contribution.ts +++ b/src/vs/workbench/browser/workbench.contribution.ts @@ -162,6 +162,11 @@ const registry = Registry.as(ConfigurationExtensions.Con 'markdownDescription': localize('enablePreviewFromQuickOpen', "Controls whether editors opened from Quick Open show as preview. Preview editors do not keep open and are reused until explicitly set to be kept open (e.g. via double click or editing). This value is ignored when `#workbench.editor.enablePreview#` is disabled."), 'default': false }, + 'workbench.editor.alwaysOpenInActiveGroupFromQuickOpen': { + 'type': 'boolean', + 'markdownDescription': localize('alwaysOpenInActiveGroupFromQuickOpen', "Controls whether editors opened from Quick Open will always open in the currently active Editor Group."), + 'default': false + }, 'workbench.editor.enablePreviewFromCodeNavigation': { 'type': 'boolean', 'markdownDescription': localize('enablePreviewFromCodeNavigation', "Controls whether editors remain in preview when a code navigation is started from them. Preview editors do not keep open and are reused until explicitly set to be kept open (e.g. via double click or editing). This value is ignored when `#workbench.editor.enablePreview#` is disabled."), diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index 8783064aa6256..1954c7756b987 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -850,6 +850,7 @@ interface IEditorPartConfiguration { closeEmptyGroups?: boolean; autoLockGroups?: Set; revealIfOpen?: boolean; + alwaysOpenInActiveGroupFromQuickOpen?: boolean; mouseBackForwardToNavigate?: boolean; labelFormat?: 'default' | 'short' | 'medium' | 'long'; restoreViewState?: boolean;