diff --git a/src/vs/workbench/browser/quickopen.ts b/src/vs/workbench/browser/quickopen.ts index 72f5874fc41b6..dbe507aa106a4 100644 --- a/src/vs/workbench/browser/quickopen.ts +++ b/src/vs/workbench/browser/quickopen.ts @@ -247,20 +247,26 @@ export class EditorQuickOpenEntry extends QuickOpenEntry implements IEditorQuick } public run(mode: Mode, context: IEntryRunContext): boolean { - if (mode === Mode.OPEN) { - let sideBySide = context.keymods.indexOf(KeyMod.CtrlCmd) >= 0; - - let input = this.getInput(); - if (input instanceof EditorInput) { - this.editorService.openEditor(input, this.getOptions(), sideBySide).done(null, errors.onUnexpectedError); - } else { - this.editorService.openEditor(input, sideBySide).done(null, errors.onUnexpectedError); - } + let sideBySide = context.keymods.indexOf(KeyMod.CtrlCmd) >= 0; + + let input = this.getInput(); + let options = this.getOptions(); - return true; + const isPreview = mode === Mode.PREVIEW; + + if (input instanceof EditorInput) { + if (isPreview) { + options.preserveFocus = true; + } + this.editorService.openEditor(input, options, sideBySide).done(null, errors.onUnexpectedError); + } else { + if (isPreview) { + (input).options.preserveFocus = true; + } + this.editorService.openEditor(input, sideBySide).done(null, errors.onUnexpectedError); } - return false; + return !isPreview; } }