Merge from vscode 0a7364f00514c46c9caceece15e1f82f82e3712f

This commit is contained in:
ADS Merger
2020-07-22 03:06:57 +00:00
parent 53ec7585a9
commit 1b7b54ce14
229 changed files with 5099 additions and 3188 deletions

View File

@@ -70,14 +70,18 @@ export class LaunchMainService implements ILaunchMainService {
@IConfigurationService private readonly configurationService: IConfigurationService
) { }
start(args: ParsedArgs, userEnv: IProcessEnvironment): Promise<void> {
async start(args: ParsedArgs, userEnv: IProcessEnvironment): Promise<void> {
this.logService.trace('Received data from other instance: ', args, userEnv);
const urlsToOpen = parseOpenUrl(args);
// Since we now start to open a window, make sure the app has focus.
// Focussing a window will not ensure that the application itself
// has focus, so we use the `steal: true` hint to force focus.
app.focus({ steal: true });
// Check early for open-url which is handled in URL service
const urlsToOpen = parseOpenUrl(args);
if (urlsToOpen.length) {
let whenWindowReady: Promise<any> = Promise.resolve<any>(null);
let whenWindowReady: Promise<unknown> = Promise.resolve();
// Create a window if there is none
if (this.windowsMainService.getWindowCount() === 0) {
@@ -91,12 +95,12 @@ export class LaunchMainService implements ILaunchMainService {
this.urlService.open(url);
}
});
return Promise.resolve(undefined);
}
// Otherwise handle in windows service
return this.startOpenWindow(args, userEnv);
else {
return this.startOpenWindow(args, userEnv);
}
}
private startOpenWindow(args: ParsedArgs, userEnv: IProcessEnvironment): Promise<void> {
@@ -156,8 +160,6 @@ export class LaunchMainService implements ILaunchMainService {
else {
const lastActive = this.windowsMainService.getLastActiveWindow();
if (lastActive) {
// Force focus the app before requesting window focus
app.focus({ steal: true });
lastActive.focus();
usedWindows = [lastActive];