diff --git a/extensions/vscode-test-resolver/src/extension.ts b/extensions/vscode-test-resolver/src/extension.ts index d33fe9cdbbf..99d3619e316 100644 --- a/extensions/vscode-test-resolver/src/extension.ts +++ b/extensions/vscode-test-resolver/src/extension.ts @@ -302,7 +302,7 @@ function getActions(): ActionItem[] { actions.push({ title: 'Close Remote', execute: async () => { - await vscode.commands.executeCommand('vscode.newWindow', { reuseWindow: true }); + await vscode.commands.executeCommand('vscode.newWindow', { reuseWindow: true, remoteAuthority: null }); } }); } diff --git a/src/vs/platform/native/electron-main/nativeHostMainService.ts b/src/vs/platform/native/electron-main/nativeHostMainService.ts index 60915434baa..65f41a268ca 100644 --- a/src/vs/platform/native/electron-main/nativeHostMainService.ts +++ b/src/vs/platform/native/electron-main/nativeHostMainService.ts @@ -162,7 +162,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain gotoLineMode: options.gotoLineMode, noRecentEntry: options.noRecentEntry, waitMarkerFileURI: options.waitMarkerFileURI, - remoteAuthority: options.remoteAuthority + remoteAuthority: options.remoteAuthority || undefined }); } } diff --git a/src/vs/platform/windows/common/windows.ts b/src/vs/platform/windows/common/windows.ts index fcedb922e87..bed1738fba3 100644 --- a/src/vs/platform/windows/common/windows.ts +++ b/src/vs/platform/windows/common/windows.ts @@ -19,7 +19,7 @@ export const WindowMinimumSize = { export interface IBaseOpenWindowsOptions { readonly forceReuseWindow?: boolean; - readonly remoteAuthority?: string; /* used when no inputs are provided or inputs are neither file nor vscode-remote */ + readonly remoteAuthority?: string | null; /* used when no inputs are provided or inputs are neither file nor vscode-remote. Null forces a local window */ } export interface IOpenWindowOptions extends IBaseOpenWindowsOptions { diff --git a/src/vs/platform/windows/electron-main/windowsMainService.ts b/src/vs/platform/windows/electron-main/windowsMainService.ts index a969d5820b3..05e81e3bb92 100644 --- a/src/vs/platform/windows/electron-main/windowsMainService.ts +++ b/src/vs/platform/windows/electron-main/windowsMainService.ts @@ -160,7 +160,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic openEmptyWindow(openConfig: IOpenEmptyConfiguration, options?: IOpenEmptyWindowOptions): ICodeWindow[] { let cli = this.environmentMainService.args; - const remoteAuthority = options?.remoteAuthority; + const remoteAuthority = options?.remoteAuthority || undefined; const forceEmpty = true; const forceReuseWindow = options?.forceReuseWindow; const forceNewWindow = !forceReuseWindow; diff --git a/src/vs/workbench/api/common/apiCommands.ts b/src/vs/workbench/api/common/apiCommands.ts index 6db9b3b4223..40e3da67e85 100644 --- a/src/vs/workbench/api/common/apiCommands.ts +++ b/src/vs/workbench/api/common/apiCommands.ts @@ -32,7 +32,7 @@ function adjustHandler(handler: (executor: ICommandsExecutor, ...args: any[]) => interface INewWindowAPICommandOptions { reuseWindow?: boolean; - remoteAuthority?: string; + remoteAuthority?: string | null; /* allow null to force a local window */ } export class NewWindowAPICommand { diff --git a/src/vs/workbench/browser/actions/windowActions.ts b/src/vs/workbench/browser/actions/windowActions.ts index 758a5b12d3c..de5ccf08d31 100644 --- a/src/vs/workbench/browser/actions/windowActions.ts +++ b/src/vs/workbench/browser/actions/windowActions.ts @@ -343,7 +343,7 @@ export class NewWindowAction extends Action { } run(): Promise { - return this.hostService.openWindow(); + return this.hostService.openWindow({ remoteAuthority: null }); } } diff --git a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts index 21b2f92e80f..7291277e7d0 100644 --- a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts +++ b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts @@ -98,7 +98,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr f1: true }); } - run = () => that.remoteAuthority && that.hostService.openWindow({ forceReuseWindow: true, remoteAuthority: undefined }); + run = () => that.remoteAuthority && that.hostService.openWindow({ forceReuseWindow: true, remoteAuthority: null }); }); MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { diff --git a/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts b/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts index 8c736b7fd20..a9e065ae5ee 100644 --- a/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts +++ b/src/vs/workbench/services/host/electron-sandbox/nativeHostService.ts @@ -66,8 +66,8 @@ export class NativeHostService extends Disposable implements IHostService { if (!!remoteAuthority) { toOpen.forEach(openable => openable.label = openable.label || this.getRecentLabel(openable)); - if (!options || !options.hasOwnProperty('remoteAuthority')) { - // pass the remoteAuthority of the window the request came from. + if (options?.remoteAuthority === undefined) { + // set the remoteAuthority of the window the request came from. // It will be used when the input is neither file nor vscode-remote. options = options ? { ...options, remoteAuthority } : { remoteAuthority }; }