pathArguments => paths

This commit is contained in:
Benjamin Pasero 2016-08-18 10:00:27 +02:00
parent 14a2d834a7
commit d657555c0b
4 changed files with 17 additions and 17 deletions

View file

@ -28,7 +28,7 @@ export interface IProcessEnvironment {
}
export interface ICommandLineArguments extends ParsedArgs {
pathArguments?: string[];
paths?: string[];
}
export const IEnvService = createDecorator<IEnvService>('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),

View file

@ -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({

View file

@ -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

View file

@ -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