align wait, diff in cli and env

This commit is contained in:
Benjamin Pasero 2016-08-17 12:16:58 +02:00
parent 11d06f3e2a
commit bd1af53f54
5 changed files with 20 additions and 20 deletions

View file

@ -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<IEnvService>('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;

View file

@ -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<void>((c, e) => {

View file

@ -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();
}
});

View file

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

View file

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