Merge from vscode 966b87dd4013be1a9c06e2b8334522ec61905cc2 (#4696)

This commit is contained in:
Anthony Dresser
2019-03-26 11:43:38 -07:00
committed by GitHub
parent b1393ae615
commit 0d8ef9583b
268 changed files with 5947 additions and 3422 deletions

View File

@@ -163,9 +163,11 @@ export class LaunchService implements ILaunchService {
const context = !!userEnv['VSCODE_CLI'] ? OpenContext.CLI : OpenContext.DESKTOP;
let usedWindows: ICodeWindow[] = [];
const waitMarkerFileURI = args.wait && args.waitMarkerFilePath ? URI.file(args.waitMarkerFilePath) : undefined;
// Special case extension development
if (!!args.extensionDevelopmentPath) {
this.windowsMainService.openExtensionDevelopmentHostWindow(args.extensionDevelopmentPath, { context, cli: args, userEnv });
this.windowsMainService.openExtensionDevelopmentHostWindow(args.extensionDevelopmentPath, { context, cli: args, userEnv, waitMarkerFileURI });
}
// Start without file/folder arguments
@@ -199,7 +201,14 @@ export class LaunchService implements ILaunchService {
}
if (openNewWindow) {
usedWindows = this.windowsMainService.open({ context, cli: args, userEnv, forceNewWindow: true, forceEmpty: true });
usedWindows = this.windowsMainService.open({
context,
cli: args,
userEnv,
forceNewWindow: true,
forceEmpty: true,
waitMarkerFileURI
});
} else {
usedWindows = [this.windowsMainService.focusLastActive(args, context)];
}
@@ -216,7 +225,8 @@ export class LaunchService implements ILaunchService {
forceReuseWindow: args['reuse-window'],
diffMode: args.diff,
addMode: args.add,
noRecentEntry: !!args['skip-add-to-recently-opened']
noRecentEntry: !!args['skip-add-to-recently-opened'],
waitMarkerFileURI
});
}
@@ -232,10 +242,10 @@ export class LaunchService implements ILaunchService {
// 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.
// In addition, we poll for the wait marker file to be deleted to return.
if (args.wait && args.waitMarkerFilePath && usedWindows.length === 1 && usedWindows[0]) {
if (waitMarkerFileURI && usedWindows.length === 1 && usedWindows[0]) {
return Promise.race([
this.windowsMainService.waitForWindowCloseOrLoad(usedWindows[0].id),
whenDeleted(args.waitMarkerFilePath)
whenDeleted(waitMarkerFileURI.fsPath)
]).then(() => undefined, () => undefined);
}