diff --git a/src/vs/code/electron-main/env.ts b/src/vs/code/electron-main/env.ts index f8372de635f..ba216ec6257 100644 --- a/src/vs/code/electron-main/env.ts +++ b/src/vs/code/electron-main/env.ts @@ -40,12 +40,12 @@ export interface ICommandLineArguments { programStart: number; pathArguments?: string[]; performance?: boolean; - openNewWindow?: boolean; - openInSameWindow?: boolean; - gotoLineMode?: boolean; - diffMode?: boolean; + 'new-window'?: boolean; + 'reuse-window'?: boolean; + goto?: boolean; + diff?: boolean; locale?: string; - waitForWindowClose?: boolean; + wait?: boolean; } export const IEnvService = createDecorator('mainEnvironmentService'); @@ -176,16 +176,16 @@ export class EnvService implements IEnvService { debugBrkPluginHost: !!debugBrkExtensionHostPort, logExtensionHostCommunication: argv.logExtensionHostCommunication, debugBrkFileWatcherPort: debugBrkFileWatcherPort ? String(debugBrkFileWatcherPort) : void 0, - openNewWindow: argv['new-window'], - openInSameWindow: argv['reuse-window'], - gotoLineMode: argv.goto, - diffMode: argv.diff && pathArguments.length === 2, + 'new-window': argv['new-window'], + 'reuse-window': argv['reuse-window'], + goto: argv.goto, + diff: argv.diff && pathArguments.length === 2, extensionHomePath: normalizePath(argv.extensionHomePath), extensionDevelopmentPath: normalizePath(argv.extensionDevelopmentPath), extensionTestsPath: normalizePath(argv.extensionTestsPath), 'disable-extensions': argv['disable-extensions'], locale: argv.locale, - waitForWindowClose: argv.wait + wait: argv.wait }); this._isTestingFromCli = this.cliArgs.extensionTestsPath && !this.cliArgs.debugBrkPluginHost; diff --git a/src/vs/code/electron-main/launch.ts b/src/vs/code/electron-main/launch.ts index 2d0490fe51f..1207568fec3 100644 --- a/src/vs/code/electron-main/launch.ts +++ b/src/vs/code/electron-main/launch.ts @@ -62,7 +62,7 @@ export class LaunchService implements ILaunchService { let usedWindows: VSCodeWindow[]; if (!!args.extensionDevelopmentPath) { this.windowsService.openPluginDevelopmentHostWindow({ cli: args, userEnv }); - } else if (args.pathArguments.length === 0 && args.openNewWindow) { + } else if (args.pathArguments.length === 0 && args['new-window']) { usedWindows = this.windowsService.open({ cli: args, userEnv, forceNewWindow: true, forceEmpty: true }); } else if (args.pathArguments.length === 0) { usedWindows = [this.windowsService.focusLastActive(args)]; @@ -70,15 +70,15 @@ export class LaunchService implements ILaunchService { usedWindows = this.windowsService.open({ cli: args, userEnv, - forceNewWindow: args.waitForWindowClose || args.openNewWindow, - preferNewWindow: !args.openInSameWindow, - diffMode: args.diffMode + forceNewWindow: args.wait || args['new-window'], + preferNewWindow: !args['reuse-window'], + diffMode: args.diff }); } // If the other instance is waiting to be killed, we hook up a window listener if one window // is being used and only then resolve the startup promise which will kill this second instance - if (args.waitForWindowClose && usedWindows && usedWindows.length === 1 && usedWindows[0]) { + if (args.wait && usedWindows && usedWindows.length === 1 && usedWindows[0]) { const windowId = usedWindows[0].id; return new TPromise((c, e) => { diff --git a/src/vs/code/electron-main/lifecycle.ts b/src/vs/code/electron-main/lifecycle.ts index b1615850f6d..7c4c9880856 100644 --- a/src/vs/code/electron-main/lifecycle.ts +++ b/src/vs/code/electron-main/lifecycle.ts @@ -109,7 +109,7 @@ export class LifecycleService implements ILifecycleService { // Windows/Linux: we quit when all windows have closed // Mac: we only quit when quit was requested // --wait: we quit when all windows are closed - if (this.quitRequested || process.platform !== 'darwin' || this.envService.cliArgs.waitForWindowClose) { + if (this.quitRequested || process.platform !== 'darwin' || this.envService.cliArgs.wait) { app.quit(); } }); diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index 3f3af241774..d03294c25a7 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -195,12 +195,12 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: IProce updateService.initialize(); // Open our first window - if (envService.cliArgs.openNewWindow && envService.cliArgs.pathArguments.length === 0) { + if (envService.cliArgs['new-window'] && envService.cliArgs.pathArguments.length === 0) { windowsService.open({ cli: envService.cliArgs, forceNewWindow: true, forceEmpty: true }); // new window if "-n" was used without paths } else if (global.macOpenFiles && global.macOpenFiles.length && (!envService.cliArgs.pathArguments || !envService.cliArgs.pathArguments.length)) { windowsService.open({ cli: envService.cliArgs, pathsToOpen: global.macOpenFiles }); // mac: open-file event received on startup } else { - windowsService.open({ cli: envService.cliArgs, forceNewWindow: envService.cliArgs.openNewWindow, diffMode: envService.cliArgs.diffMode }); // default: read paths from cli + windowsService.open({ cli: envService.cliArgs, forceNewWindow: envService.cliArgs['new-window'], diffMode: envService.cliArgs.diff }); // default: read paths from cli } } diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index 242340a50ac..336bc754302 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -502,7 +502,7 @@ export class WindowsManager implements IWindowsService { // Find paths from provided paths if any if (openConfig.pathsToOpen && openConfig.pathsToOpen.length > 0) { iPathsToOpen = openConfig.pathsToOpen.map((pathToOpen) => { - let iPath = this.toIPath(pathToOpen, false, openConfig.cli && openConfig.cli.gotoLineMode); + let iPath = this.toIPath(pathToOpen, false, openConfig.cli && openConfig.cli.goto); // Warn if the requested path to open does not exist if (!iPath) { @@ -873,7 +873,7 @@ export class WindowsManager implements IWindowsService { } } - let iPaths = candidates.map((candidate) => this.toIPath(candidate, ignoreFileNotFound, cli.gotoLineMode)).filter((path) => !!path); + let iPaths = candidates.map((candidate) => this.toIPath(candidate, ignoreFileNotFound, cli.goto)).filter((path) => !!path); if (iPaths.length > 0) { return iPaths; }