Initial VS Code 1.19 source merge (#571)

* Initial 1.19 xcopy

* Fix yarn build

* Fix numerous build breaks

* Next batch of build break fixes

* More build break fixes

* Runtime breaks

* Additional post merge fixes

* Fix windows setup file

* Fix test failures.

* Update license header blocks to refer to source eula
This commit is contained in:
Karl Burtram
2018-01-28 23:37:17 -08:00
committed by GitHub
parent 9a1ac20710
commit 251ae01c3e
8009 changed files with 93378 additions and 35634 deletions

View File

@@ -15,6 +15,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
import { OpenContext } from 'vs/platform/windows/common/windows';
import { IWindowsMainService, ICodeWindow } from 'vs/platform/windows/electron-main/windows';
import { whenDeleted } from 'vs/base/node/pfs';
import { IWorkspacesMainService } from 'vs/platform/workspaces/common/workspaces';
export const ID = 'launchService';
export const ILaunchService = createDecorator<ILaunchService>(ID);
@@ -24,15 +25,28 @@ export interface IStartArguments {
userEnv: IProcessEnvironment;
}
export interface IWindowInfo {
pid: number;
title: string;
folders: string[];
}
export interface IMainProcessInfo {
mainPID: number;
windows: IWindowInfo[];
}
export interface ILaunchService {
_serviceBrand: any;
start(args: ParsedArgs, userEnv: IProcessEnvironment): TPromise<void>;
getMainProcessId(): TPromise<number>;
getMainProcessInfo(): TPromise<IMainProcessInfo>;
}
export interface ILaunchChannel extends IChannel {
call(command: 'start', arg: IStartArguments): TPromise<void>;
call(command: 'get-main-process-id', arg: null): TPromise<any>;
call(command: 'get-main-process-info', arg: null): TPromise<any>;
call(command: string, arg: any): TPromise<any>;
}
@@ -48,6 +62,9 @@ export class LaunchChannel implements ILaunchChannel {
case 'get-main-process-id':
return this.service.getMainProcessId();
case 'get-main-process-info':
return this.service.getMainProcessInfo();
}
return undefined;
@@ -67,6 +84,10 @@ export class LaunchChannelClient implements ILaunchService {
public getMainProcessId(): TPromise<number> {
return this.channel.call('get-main-process-id', null);
}
public getMainProcessInfo(): TPromise<IMainProcessInfo> {
return this.channel.call('get-main-process-info', null);
}
}
export class LaunchService implements ILaunchService {
@@ -75,18 +96,18 @@ export class LaunchService implements ILaunchService {
constructor(
@ILogService private logService: ILogService,
@IWindowsMainService private windowsService: IWindowsMainService,
@IURLService private urlService: IURLService
@IWindowsMainService private windowsMainService: IWindowsMainService,
@IURLService private urlService: IURLService,
@IWorkspacesMainService private workspacesMainService: IWorkspacesMainService
) { }
public start(args: ParsedArgs, userEnv: IProcessEnvironment): TPromise<void> {
this.logService.log('Received data from other instance: ', args, userEnv);
this.logService.trace('Received data from other instance: ', args, userEnv);
// Check early for open-url which is handled in URL service
if (args['open-url'] && args._urls && args._urls.length > 0) {
// --open-url must contain -- followed by the url(s)
// process.argv is used over args._ as args._ are resolved to file paths at this point
args._urls.forEach(url => this.urlService.open(url));
const openUrl = (args['open-url'] ? args._urls : []) || [];
if (openUrl.length > 0) {
openUrl.forEach(url => this.urlService.open(url));
return TPromise.as(null);
}
@@ -95,13 +116,13 @@ export class LaunchService implements ILaunchService {
const context = !!userEnv['VSCODE_CLI'] ? OpenContext.CLI : OpenContext.DESKTOP;
let usedWindows: ICodeWindow[];
if (!!args.extensionDevelopmentPath) {
this.windowsService.openExtensionDevelopmentHostWindow({ context, cli: args, userEnv });
this.windowsMainService.openExtensionDevelopmentHostWindow({ context, cli: args, userEnv });
} else if (args._.length === 0 && (args['new-window'] || args['unity-launch'])) {
usedWindows = this.windowsService.open({ context, cli: args, userEnv, forceNewWindow: true, forceEmpty: true });
usedWindows = this.windowsMainService.open({ context, cli: args, userEnv, forceNewWindow: true, forceEmpty: true });
} else if (args._.length === 0) {
usedWindows = [this.windowsService.focusLastActive(args, context)];
usedWindows = [this.windowsMainService.focusLastActive(args, context)];
} else {
usedWindows = this.windowsService.open({
usedWindows = this.windowsMainService.open({
context,
cli: args,
userEnv,
@@ -118,7 +139,7 @@ export class LaunchService implements ILaunchService {
// In addition, we poll for the wait marker file to be deleted to return.
if (args.wait && usedWindows.length === 1 && usedWindows[0]) {
return TPromise.any([
this.windowsService.waitForWindowCloseOrLoad(usedWindows[0].id),
this.windowsMainService.waitForWindowCloseOrLoad(usedWindows[0].id),
whenDeleted(args.waitMarkerFilePath)
]).then(() => void 0, () => void 0);
}
@@ -127,8 +148,40 @@ export class LaunchService implements ILaunchService {
}
public getMainProcessId(): TPromise<number> {
this.logService.log('Received request for process ID from other instance.');
this.logService.trace('Received request for process ID from other instance.');
return TPromise.as(process.pid);
}
public getMainProcessInfo(): TPromise<IMainProcessInfo> {
this.logService.trace('Received request for main process info from other instance.');
return TPromise.wrap({
mainPID: process.pid,
windows: this.windowsMainService.getWindows().map(window => {
return this.getWindowInfo(window);
})
} as IMainProcessInfo);
}
private getWindowInfo(window: ICodeWindow): IWindowInfo {
const folders: string[] = [];
if (window.openedFolderPath) {
folders.push(window.openedFolderPath);
} else if (window.openedWorkspace) {
const rootFolders = this.workspacesMainService.resolveWorkspaceSync(window.openedWorkspace.configPath).folders;
rootFolders.forEach(root => {
if (root.uri.scheme === 'file') {
folders.push(root.uri.fsPath);
}
});
}
return {
pid: window.win.webContents.getOSProcessId(),
title: window.win.getTitle(),
folders
} as IWindowInfo;
}
}