diff --git a/src/vs/code/electron-main/env.ts b/src/vs/code/electron-main/env.ts index dbc939afa84..e729e48bc5b 100644 --- a/src/vs/code/electron-main/env.ts +++ b/src/vs/code/electron-main/env.ts @@ -28,7 +28,7 @@ export interface IProcessEnvironment { } export interface ICommandLineArguments extends ParsedArgs { - pathArguments?: string[]; + paths?: string[]; } export const IEnvService = createDecorator('mainEnvironmentService'); @@ -147,13 +147,13 @@ export class EnvService implements IEnvService { const debugExtensionHostPort = getNumericValue(argv.debugPluginHost, 5870, this.isBuilt ? void 0 : 5870); const debugPluginHost = debugBrkExtensionHostPort ? String(debugBrkExtensionHostPort) : debugExtensionHostPort ? String(debugExtensionHostPort): void 0; const debugBrkPluginHost = debugBrkExtensionHostPort ? String(true) : void 0; - const pathArguments = parsePathArguments(this._currentWorkingDirectory, argv._, argv.goto); + const paths = parsePathArguments(this._currentWorkingDirectory, argv._, argv.goto); const timestamp = parseInt(argv.timestamp); const debugBrkFileWatcherPort = getNumericValue(argv.debugBrkFileWatcherPort, void 0); this._cliArgs = Object.freeze({ _: [], - pathArguments, + paths, timestamp: types.isNumber(timestamp) ? String(timestamp) : '0', performance: argv.performance, verbose: argv.verbose, @@ -164,7 +164,7 @@ export class EnvService implements IEnvService { 'new-window': argv['new-window'], 'reuse-window': argv['reuse-window'], goto: argv.goto, - diff: argv.diff && pathArguments.length === 2, + diff: argv.diff && paths.length === 2, extensionHomePath: normalizePath(argv.extensionHomePath), extensionDevelopmentPath: normalizePath(argv.extensionDevelopmentPath), extensionTestsPath: normalizePath(argv.extensionTestsPath), diff --git a/src/vs/code/electron-main/launch.ts b/src/vs/code/electron-main/launch.ts index 1207568fec3..d2485997bd0 100644 --- a/src/vs/code/electron-main/launch.ts +++ b/src/vs/code/electron-main/launch.ts @@ -62,9 +62,9 @@ export class LaunchService implements ILaunchService { let usedWindows: VSCodeWindow[]; if (!!args.extensionDevelopmentPath) { this.windowsService.openPluginDevelopmentHostWindow({ cli: args, userEnv }); - } else if (args.pathArguments.length === 0 && args['new-window']) { + } else if (args.paths.length === 0 && args['new-window']) { usedWindows = this.windowsService.open({ cli: args, userEnv, forceNewWindow: true, forceEmpty: true }); - } else if (args.pathArguments.length === 0) { + } else if (args.paths.length === 0) { usedWindows = [this.windowsService.focusLastActive(args)]; } else { usedWindows = this.windowsService.open({ diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index 9988ff0d8fc..1a7f57bf130 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -195,9 +195,9 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: IProce updateService.initialize(); // Open our first window - if (envService.cliArgs['new-window'] && envService.cliArgs.pathArguments.length === 0) { + if (envService.cliArgs['new-window'] && envService.cliArgs.paths.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)) { + } else if (global.macOpenFiles && global.macOpenFiles.length && (!envService.cliArgs.paths || !envService.cliArgs.paths.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['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 9b93d07b21b..995a7776144 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -540,7 +540,7 @@ export class WindowsManager implements IWindowsService { // Otherwise infer from command line arguments else { - let ignoreFileNotFound = openConfig.cli.pathArguments.length > 0; // we assume the user wants to create this file from command line + let ignoreFileNotFound = openConfig.cli.paths.length > 0; // we assume the user wants to create this file from command line iPathsToOpen = this.cliToPaths(openConfig.cli, ignoreFileNotFound); } @@ -705,23 +705,23 @@ export class WindowsManager implements IWindowsService { } // Fill in previously opened workspace unless an explicit path is provided and we are not unit testing - if (openConfig.cli.pathArguments.length === 0 && !openConfig.cli.extensionTestsPath) { + if (openConfig.cli.paths.length === 0 && !openConfig.cli.extensionTestsPath) { let workspaceToOpen = this.windowsState.lastPluginDevelopmentHostWindow && this.windowsState.lastPluginDevelopmentHostWindow.workspacePath; if (workspaceToOpen) { - openConfig.cli.pathArguments = [workspaceToOpen]; + openConfig.cli.paths = [workspaceToOpen]; } } // Make sure we are not asked to open a path that is already opened - if (openConfig.cli.pathArguments.length > 0) { - res = WindowsManager.WINDOWS.filter((w) => w.openedWorkspacePath && openConfig.cli.pathArguments.indexOf(w.openedWorkspacePath) >= 0); + if (openConfig.cli.paths.length > 0) { + res = WindowsManager.WINDOWS.filter((w) => w.openedWorkspacePath && openConfig.cli.paths.indexOf(w.openedWorkspacePath) >= 0); if (res.length) { - openConfig.cli.pathArguments = []; + openConfig.cli.paths = []; } } // Open it - this.open({ cli: openConfig.cli, forceNewWindow: true, forceEmpty: openConfig.cli.pathArguments.length === 0 }); + this.open({ cli: openConfig.cli, forceNewWindow: true, forceEmpty: openConfig.cli.paths.length === 0 }); } private toConfiguration(userEnv: IProcessEnvironment, cli: ICommandLineArguments, workspacePath?: string, filesToOpen?: IPath[], filesToCreate?: IPath[], filesToDiff?: IPath[], extensionsToInstall?: string[]): IWindowConfiguration { @@ -814,8 +814,8 @@ export class WindowsManager implements IWindowsService { // Check for pass in candidate or last opened path let candidates: string[] = []; - if (cli.pathArguments.length > 0) { - candidates = cli.pathArguments; + if (cli.paths.length > 0) { + candidates = cli.paths; } // No path argument, check settings for what to do now