diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index d52b74ba8da..12a1485aef1 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -1611,9 +1611,9 @@ export class WindowsManager extends Disposable implements IWindowsMainService { return getLastActiveWindow(WindowsManager.WINDOWS.filter(window => window.remoteAuthority === remoteAuthority)); } - openEmptyWindow(context: OpenContext, options?: { reuse?: boolean }): ICodeWindow[] { + openEmptyWindow(context: OpenContext, options?: { reuse?: boolean, remoteAuthority?: string }): ICodeWindow[] { let cli = this.environmentService.args; - const remote = undefined; + const remote = options && options.remoteAuthority; if (cli && (cli.remote !== remote)) { cli = { ...cli, remote }; } diff --git a/src/vs/platform/electron/electron-main/electronMainService.ts b/src/vs/platform/electron/electron-main/electronMainService.ts index b749273dacf..c62f264a871 100644 --- a/src/vs/platform/electron/electron-main/electronMainService.ts +++ b/src/vs/platform/electron/electron-main/electronMainService.ts @@ -25,7 +25,7 @@ export class ElectronMainService { return this.windowsMainService.getWindowCount(); } - async openEmptyWindow(windowId: number, options?: { reuse?: boolean }): Promise { + async openEmptyWindow(windowId: number, options?: { reuse?: boolean, remoteAuthority?: string }): Promise { this.windowsMainService.openEmptyWindow(OpenContext.API, options); } diff --git a/src/vs/platform/electron/node/electron.ts b/src/vs/platform/electron/node/electron.ts index b44620a9856..806a91f99c9 100644 --- a/src/vs/platform/electron/node/electron.ts +++ b/src/vs/platform/electron/node/electron.ts @@ -15,7 +15,7 @@ export interface IElectronService { // Window windowCount(): Promise; - openEmptyWindow(options?: { reuse?: boolean }): Promise; + openEmptyWindow(options?: { reuse?: boolean, remoteAuthority?: string }): Promise; toggleFullScreen(): Promise; // Dialogs diff --git a/src/vs/platform/windows/electron-main/windows.ts b/src/vs/platform/windows/electron-main/windows.ts index dabe6e494a8..02ea0ad1e05 100644 --- a/src/vs/platform/windows/electron-main/windows.ts +++ b/src/vs/platform/windows/electron-main/windows.ts @@ -108,7 +108,7 @@ export interface IWindowsMainService { focusLastActive(cli: ParsedArgs, context: OpenContext): ICodeWindow; getLastActiveWindow(): ICodeWindow | undefined; waitForWindowCloseOrLoad(windowId: number): Promise; - openEmptyWindow(context: OpenContext, options?: { reuse?: boolean }): ICodeWindow[]; + openEmptyWindow(context: OpenContext, options?: { reuse?: boolean, remoteAuthority?: string}): ICodeWindow[]; openNewTabbedWindow(context: OpenContext): ICodeWindow[]; openExternal(url: string): Promise; sendToFocused(channel: string, ...args: any[]): void; diff --git a/src/vs/workbench/api/common/apiCommands.ts b/src/vs/workbench/api/common/apiCommands.ts index 28bbc68d9bf..e312e341d78 100644 --- a/src/vs/workbench/api/common/apiCommands.ts +++ b/src/vs/workbench/api/common/apiCommands.ts @@ -70,12 +70,16 @@ CommandsRegistry.registerCommand({ interface INewWindowAPICommandOptions { reuseWindow?: boolean; + remoteAuthority?: string; } export class NewWindowAPICommand { public static ID = 'vscode.newWindow'; public static execute(executor: ICommandsExecutor, options?: INewWindowAPICommandOptions): Promise { - return executor.executeCommand('_files.newWindow', options); + return executor.executeCommand('_files.newWindow', { + reuse: options && options.reuseWindow, + remoteAuthority: options && options.remoteAuthority + }); } } CommandsRegistry.registerCommand({ diff --git a/src/vs/workbench/contrib/files/browser/fileCommands.ts b/src/vs/workbench/contrib/files/browser/fileCommands.ts index 5198f090431..7c2a64385c6 100644 --- a/src/vs/workbench/contrib/files/browser/fileCommands.ts +++ b/src/vs/workbench/contrib/files/browser/fileCommands.ts @@ -98,7 +98,7 @@ export const openWindowCommand = (accessor: ServicesAccessor, urisToOpen: IURITo } }; -export const newWindowCommand = (accessor: ServicesAccessor, options?: { reuse?: boolean }) => { +export const newWindowCommand = (accessor: ServicesAccessor, options?: { reuse?: boolean, remoteAuthority?: string }) => { const hostService = accessor.get(IHostService); hostService.openEmptyWindow(options); }; diff --git a/src/vs/workbench/services/host/browser/browserHostService.ts b/src/vs/workbench/services/host/browser/browserHostService.ts index a5fdc02a5e1..f12caabd2f6 100644 --- a/src/vs/workbench/services/host/browser/browserHostService.ts +++ b/src/vs/workbench/services/host/browser/browserHostService.ts @@ -17,7 +17,7 @@ export class BrowserHostService implements IHostService { readonly windowCount = Promise.resolve(1); - async openEmptyWindow(options?: { reuse?: boolean }): Promise { + async openEmptyWindow(options?: { reuse?: boolean, remoteAuthority?: string }): Promise { // TODO@Ben delegate to embedder const targetHref = `${document.location.origin}${document.location.pathname}?ew=true`; if (options && options.reuse) { diff --git a/src/vs/workbench/services/host/browser/host.ts b/src/vs/workbench/services/host/browser/host.ts index 0e36ce74c48..824ffdb4e00 100644 --- a/src/vs/workbench/services/host/browser/host.ts +++ b/src/vs/workbench/services/host/browser/host.ts @@ -22,7 +22,7 @@ export interface IHostService { * Opens an empty window. The optional parameter allows to define if * a new window should open or the existing one change to an empty. */ - openEmptyWindow(options?: { reuse?: boolean }): Promise; + openEmptyWindow(options?: { reuse?: boolean, remoteAuthority?: string }): Promise; toggleFullScreen(): Promise; diff --git a/src/vs/workbench/services/host/electron-browser/desktopHostService.ts b/src/vs/workbench/services/host/electron-browser/desktopHostService.ts index 13c2f6964af..1e79f713326 100644 --- a/src/vs/workbench/services/host/electron-browser/desktopHostService.ts +++ b/src/vs/workbench/services/host/electron-browser/desktopHostService.ts @@ -17,7 +17,7 @@ export class DesktopHostService implements IHostService { get windowCount() { return this.electronService.windowCount(); } - openEmptyWindow(options?: { reuse?: boolean }): Promise { + openEmptyWindow(options?: { reuse?: boolean, remoteAuthority?: string }): Promise { return this.electronService.openEmptyWindow(options); } diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index ea1410c7628..e5ce75c7100 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -1520,7 +1520,7 @@ export class TestHostService implements IHostService { restart(): Promise { return Promise.resolve(); } reload(): Promise { return Promise.resolve(); } - openEmptyWindow(options?: { reuse?: boolean }): Promise { return Promise.resolve(); } + openEmptyWindow(options?: { reuse?: boolean, remoteAuthority?: string }): Promise { return Promise.resolve(); } toggleFullScreen(): Promise { return Promise.resolve(); } }