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

@@ -8,7 +8,6 @@
import 'vs/css!./media/shell';
import * as nls from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import * as platform from 'vs/base/common/platform';
import { Dimension, Builder, $ } from 'vs/base/browser/builder';
import dom = require('vs/base/browser/dom');
@@ -22,16 +21,13 @@ import pkg from 'vs/platform/node/package';
import { ContextViewService } from 'vs/platform/contextview/browser/contextViewService';
import { Workbench, IWorkbenchStartedInfo } from 'vs/workbench/electron-browser/workbench';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { NullTelemetryService, configurationTelemetry, lifecycleTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { NullTelemetryService, configurationTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { IExperimentService, ExperimentService } from 'vs/platform/telemetry/common/experiments';
import { ITelemetryAppenderChannel, TelemetryAppenderClient } from 'vs/platform/telemetry/common/telemetryIpc';
import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
import { IdleMonitor, UserStatus } from 'vs/platform/telemetry/browser/idleMonitor';
import ErrorTelemetry from 'vs/platform/telemetry/browser/errorTelemetry';
import { ElectronWindow } from 'vs/workbench/electron-browser/window';
import { resolveWorkbenchCommonProperties, getOrCreateMachineId } from 'vs/platform/telemetry/node/workbenchCommonProperties';
import { machineIdIpcChannel } from 'vs/platform/telemetry/node/commonProperties';
import { WorkspaceStats } from 'vs/workbench/services/telemetry/node/workspaceStats';
import { resolveWorkbenchCommonProperties } from 'vs/platform/telemetry/node/workbenchCommonProperties';
import { IWindowsService, IWindowService, IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { WindowService } from 'vs/platform/windows/electron-browser/windowService';
import { MessageService } from 'vs/workbench/services/message/electron-browser/messageService';
@@ -44,7 +40,7 @@ import { MarkerService } from 'vs/platform/markers/common/markerService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import { CodeEditorServiceImpl } from 'vs/editor/browser/services/codeEditorServiceImpl';
import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { IntegrityServiceImpl } from 'vs/platform/integrity/node/integrityServiceImpl';
import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
import { EditorWorkerServiceImpl } from 'vs/editor/common/services/editorWorkerServiceImpl';
@@ -68,16 +64,14 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { WorkbenchModeServiceImpl } from 'vs/workbench/services/mode/common/workbenchModeService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { ICrashReporterService, NullCrashReporterService } from 'vs/workbench/services/crashReporter/common/crashReporterService';
import { CrashReporterService } from 'vs/workbench/services/crashReporter/electron-browser/crashReporterService';
import { NodeCachedDataManager } from 'vs/workbench/electron-browser/nodeCachedDataManager';
import { ICrashReporterService, NullCrashReporterService, CrashReporterService } from 'vs/workbench/services/crashReporter/electron-browser/crashReporterService';
import { getDelayedChannel } from 'vs/base/parts/ipc/common/ipc';
import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net';
import { IExtensionManagementChannel, ExtensionManagementChannelClient } from 'vs/platform/extensionManagement/common/extensionManagementIpc';
import { IExtensionManagementService, IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { ExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionEnablementService';
import { ITimerService } from 'vs/workbench/services/timer/common/timerService';
import { remote, ipcRenderer as ipc } from 'electron';
import { remote } from 'electron';
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
import { restoreFontInfo, readFontInfo, saveFontInfo } from 'vs/editor/browser/config/configuration';
import * as browser from 'vs/base/browser/browser';
@@ -93,6 +87,7 @@ import { ITextMateService } from 'vs/workbench/services/textMate/electron-browse
import { IBroadcastService, BroadcastService } from 'vs/platform/broadcast/electron-browser/broadcastService';
import { HashService } from 'vs/workbench/services/hash/node/hashService';
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
import { ILogService } from 'vs/platform/log/common/log';
/**
* Services that we require for the Shell
@@ -101,6 +96,7 @@ export interface ICoreServices {
contextService: IWorkspaceContextService;
configurationService: IConfigurationService;
environmentService: IEnvironmentService;
logService: ILogService;
timerService: ITimerService;
storageService: IStorageService;
}
@@ -115,6 +111,7 @@ export class WorkbenchShell {
private storageService: IStorageService;
private messageService: MessageService;
private environmentService: IEnvironmentService;
private logService: ILogService;
private contextViewService: ContextViewService;
private configurationService: IConfigurationService;
private contextService: IWorkspaceContextService;
@@ -145,6 +142,7 @@ export class WorkbenchShell {
this.contextService = coreServices.contextService;
this.configurationService = coreServices.configurationService;
this.environmentService = coreServices.environmentService;
this.logService = coreServices.logService;
this.timerService = coreServices.timerService;
this.storageService = coreServices.storageService;
@@ -166,40 +164,62 @@ export class WorkbenchShell {
const [instantiationService, serviceCollection] = this.initServiceCollection(parent.getHTMLElement());
// Workbench
this.workbench = instantiationService.createInstance(Workbench, parent.getHTMLElement(), workbenchContainer.getHTMLElement(), this.configuration, serviceCollection);
this.workbench.startup({
onWorkbenchStarted: (info: IWorkbenchStartedInfo) => {
this.workbench = instantiationService.createInstance(Workbench, parent.getHTMLElement(), workbenchContainer.getHTMLElement(), this.configuration, serviceCollection, this.lifecycleService);
try {
this.workbench.startup().done(startupInfos => this.onWorkbenchStarted(startupInfos, instantiationService));
} catch (error) {
// run workbench started logic
this.onWorkbenchStarted(info);
// Log it
this.logService.error(toErrorMessage(error, true));
// start cached data manager
instantiationService.createInstance(NodeCachedDataManager);
// Set lifecycle phase to `Runnning` so that other contributions
// can now do something
this.lifecycleService.phase = LifecyclePhase.Running;
}
});
// Rethrow
throw error;
}
// Window
this.workbench.getInstantiationService().createInstance(ElectronWindow, this.container);
// Handle case where workbench is not starting up properly
const timeoutHandle = setTimeout(() => {
console.warn('Workbench did not finish loading in 10 seconds, that might be a problem that should be reported.');
this.logService.warn('Workbench did not finish loading in 10 seconds, that might be a problem that should be reported.');
}, 10000);
this.workbench.joinCreation().then(() => {
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
clearTimeout(timeoutHandle);
});
return workbenchContainer;
}
private onWorkbenchStarted(info: IWorkbenchStartedInfo): void {
private onWorkbenchStarted(info: IWorkbenchStartedInfo, instantiationService: IInstantiationService): void {
// Telemetry: workspace info
// Startup Telemetry
this.logStartupTelemetry(info);
// Root Warning
if ((platform.isLinux || platform.isMacintosh) && process.getuid() === 0) {
// {{SQL CARBON EDIT}}
this.messageService.show(Severity.Warning, nls.localize('runningAsRoot', "It is recommended not to run SQL Operations Studio as 'root'."));
}
// Set lifecycle phase to `Runnning` so that other contributions can now do something
this.lifecycleService.phase = LifecyclePhase.Running;
// Set lifecycle phase to `Runnning For A Bit` after a short delay
let timeoutHandle = setTimeout(() => {
timeoutHandle = void 0;
this.lifecycleService.phase = LifecyclePhase.Eventually;
}, 3000);
this.toUnbind.push({
dispose: () => {
if (timeoutHandle) {
clearTimeout(timeoutHandle);
}
}
});
}
private logStartupTelemetry(info: IWorkbenchStartedInfo): void {
const { filesToOpen, filesToCreate, filesToDiff } = this.configuration;
/* __GDPR__
"workspaceLoad" : {
@@ -244,7 +264,7 @@ export class WorkbenchShell {
this.timerService.workbenchStarted = Date.now();
this.timerService.restoreEditorsDuration = info.restoreEditorsDuration;
this.timerService.restoreViewletDuration = info.restoreViewletDuration;
this.extensionService.onReady().done(() => {
this.extensionService.whenInstalledExtensionsRegistered().done(() => {
/* __GDPR__
"startupTime" : {
"${include}": [
@@ -254,16 +274,6 @@ export class WorkbenchShell {
*/
this.telemetryService.publicLog('startupTime', this.timerService.startupMetrics);
});
// Telemetry: workspace tags
const workspaceStats: WorkspaceStats = <WorkspaceStats>this.workbench.getInstantiationService().createInstance(WorkspaceStats);
workspaceStats.reportWorkspaceTags(this.configuration);
workspaceStats.reportCloudStats();
if ((platform.isLinux || platform.isMacintosh) && process.getuid() === 0) {
// {{SQL CARBON EDIT}}
this.messageService.show(Severity.Warning, nls.localize('runningAsRoot', "It is recommended not to run sqlops as 'root'."));
}
}
private initServiceCollection(container: HTMLElement): [IInstantiationService, ServiceCollection] {
@@ -273,6 +283,9 @@ export class WorkbenchShell {
serviceCollection.set(IWorkspaceContextService, this.contextService);
serviceCollection.set(IConfigurationService, this.configurationService);
serviceCollection.set(IEnvironmentService, this.environmentService);
serviceCollection.set(ILogService, this.logService);
disposables.push(this.logService);
serviceCollection.set(ITimerService, this.timerService);
serviceCollection.set(IStorageService, this.storageService);
this.mainProcessServices.forEach((serviceIdentifier, serviceInstance) => {
@@ -284,7 +297,7 @@ export class WorkbenchShell {
this.broadcastService = new BroadcastService(currentWindow.id);
serviceCollection.set(IBroadcastService, this.broadcastService);
serviceCollection.set(IWindowService, new SyncDescriptor(WindowService, currentWindow.id));
serviceCollection.set(IWindowService, new SyncDescriptor(WindowService, currentWindow.id, this.configuration));
const sharedProcess = (<IWindowsService>serviceCollection.get(IWindowsService)).whenSharedProcessReady()
.then(() => connectNet(this.environmentService.sharedIPCHandle, `window:${currentWindow.id}`));
@@ -294,7 +307,7 @@ export class WorkbenchShell {
// Warm up font cache information before building up too many dom elements
restoreFontInfo(this.storageService);
readFontInfo(BareFontInfo.createFromRawSettings(this.configurationService.getConfiguration('editor'), browser.getZoomLevel()));
readFontInfo(BareFontInfo.createFromRawSettings(this.configurationService.getValue('editor'), browser.getZoomLevel()));
// Hash
serviceCollection.set(IHashService, new SyncDescriptor(HashService));
@@ -304,7 +317,6 @@ export class WorkbenchShell {
serviceCollection.set(IExperimentService, this.experimentService);
// Telemetry
this.sendMachineIdToMain(this.storageService);
if (this.environmentService.isBuilt && !this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!product.enableTelemetry) {
const channel = getDelayedChannel<ITelemetryAppenderChannel>(sharedProcess.then(c => c.getChannel('telemetryAppender')));
const commit = product.commit;
@@ -312,7 +324,7 @@ export class WorkbenchShell {
const config: ITelemetryServiceConfig = {
appender: new TelemetryAppenderClient(channel),
commonProperties: resolveWorkbenchCommonProperties(this.storageService, commit, version, this.environmentService.installSource),
commonProperties: resolveWorkbenchCommonProperties(this.storageService, commit, version, this.configuration.machineId, this.environmentService.installSourcePath),
piiPaths: [this.environmentService.appRoot, this.environmentService.extensionsPath]
};
@@ -320,21 +332,8 @@ export class WorkbenchShell {
this.telemetryService = telemetryService;
const errorTelemetry = new ErrorTelemetry(telemetryService);
const idleMonitor = new IdleMonitor(2 * 60 * 1000); // 2 minutes
const listener = idleMonitor.onStatusChange(status =>
/* __GDPR__
"UserIdleStart" : {}
*/
/* __GDPR__
"UserIdleStop" : {}
*/
this.telemetryService.publicLog(status === UserStatus.Active
? TelemetryService.IDLE_STOP_EVENT_NAME
: TelemetryService.IDLE_START_EVENT_NAME
));
disposables.push(telemetryService, errorTelemetry, listener, idleMonitor);
disposables.push(telemetryService, errorTelemetry);
} else {
this.telemetryService = NullTelemetryService;
}
@@ -356,7 +355,6 @@ export class WorkbenchShell {
this.toUnbind.push(lifecycleService.onShutdown(reason => dispose(disposables)));
this.toUnbind.push(lifecycleService.onShutdown(reason => saveFontInfo(this.storageService)));
serviceCollection.set(ILifecycleService, lifecycleService);
disposables.push(lifecycleTelemetry(this.telemetryService, lifecycleService));
this.lifecycleService = lifecycleService;
const extensionManagementChannel = getDelayedChannel<IExtensionManagementChannel>(sharedProcess.then(c => c.getChannel('extensions')));
@@ -370,7 +368,7 @@ export class WorkbenchShell {
serviceCollection.set(IExtensionService, this.extensionService);
this.timerService.beforeExtensionLoad = Date.now();
this.extensionService.onReady().done(() => {
this.extensionService.whenInstalledExtensionsRegistered().done(() => {
this.timerService.afterExtensionLoad = Date.now();
});
@@ -407,12 +405,6 @@ export class WorkbenchShell {
return [instantiationService, serviceCollection];
}
private sendMachineIdToMain(storageService: IStorageService) {
getOrCreateMachineId(storageService).then(machineId => {
ipc.send(machineIdIpcChannel, machineId);
}).then(null, errors.onUnexpectedError);
}
public open(): void {
// Listen on unexpected errors
@@ -456,8 +448,8 @@ export class WorkbenchShell {
this.previousErrorTime = now;
this.previousErrorValue = errorMsg;
// Log to console
console.error(errorMsg);
// Log it
this.logService.error(errorMsg);
// Show to user if friendly message provided
if (error && error.friendlyMessage && this.messageService) {
@@ -475,10 +467,6 @@ export class WorkbenchShell {
this.workbench.layout();
}
public joinCreation(): TPromise<boolean> {
return this.workbench.joinCreation();
}
public dispose(): void {
// Workbench