Merge from vscode 7653d836944892f83ce9e1f95c1204bafa1aec31

This commit is contained in:
ADS Merger
2020-05-08 03:58:34 +00:00
parent dac1970c43
commit fa62ec1f34
209 changed files with 5131 additions and 2480 deletions

View File

@@ -20,9 +20,8 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/nativeKeymapService';
import { INativeWindowConfiguration } from 'vs/platform/windows/node/window';
import { ISingleFolderWorkspaceIdentifier, IWorkspaceInitializationPayload, ISingleFolderWorkspaceInitializationPayload, reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { ConsoleLogService, MultiplexLogService, ILogService, ConsoleLogInMainService } from 'vs/platform/log/common/log';
import { ILogService } from 'vs/platform/log/common/log';
import { NativeStorageService } from 'vs/platform/storage/node/storageService';
import { LoggerChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc';
import { Schemas } from 'vs/base/common/network';
import { sanitizeFilePath } from 'vs/base/common/extpath';
import { GlobalStorageDatabaseChannelClient } from 'vs/platform/storage/node/storageIpc';
@@ -41,7 +40,6 @@ import { IFileService } from 'vs/platform/files/common/files';
import { DiskFileSystemProvider } from 'vs/platform/files/electron-browser/diskFileSystemProvider';
import { RemoteFileSystemProvider } from 'vs/workbench/services/remote/common/remoteAgentFileSystemChannel';
import { ConfigurationCache } from 'vs/workbench/services/configuration/node/configurationCache';
import { SpdLogService } from 'vs/platform/log/node/spdlogService';
import { SignService } from 'vs/platform/sign/node/signService';
import { ISignService } from 'vs/platform/sign/common/sign';
import { FileUserDataProvider } from 'vs/workbench/services/userData/common/fileUserDataProvider';
@@ -50,6 +48,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import product from 'vs/platform/product/common/product';
import { NativeResourceIdentityService } from 'vs/platform/resource/node/resourceIdentityServiceImpl';
import { IResourceIdentityService } from 'vs/platform/resource/common/resourceIdentityService';
import { DesktopLogService } from 'vs/workbench/services/log/electron-browser/logService';
class DesktopMain extends Disposable {
@@ -181,7 +180,7 @@ class DesktopMain extends Disposable {
serviceCollection.set(IProductService, { _serviceBrand: undefined, ...product });
// Log
const logService = this._register(this.createLogService(mainProcessService, this.environmentService));
const logService = this._register(new DesktopLogService(this.configuration.windowId, mainProcessService, this.environmentService));
serviceCollection.set(ILogService, logService);
// Remote
@@ -203,7 +202,7 @@ class DesktopMain extends Disposable {
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
// User Data Provider
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(this.environmentService.appSettingsHome, this.environmentService.backupHome, diskFileSystemProvider, this.environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(this.environmentService.appSettingsHome, this.environmentService.backupHome, diskFileSystemProvider, this.environmentService, logService));
const connection = remoteAgentService.getConnection();
if (connection) {
@@ -314,27 +313,6 @@ class DesktopMain extends Disposable {
}
}
private createLogService(mainProcessService: IMainProcessService, environmentService: IWorkbenchEnvironmentService): ILogService {
const loggerClient = new LoggerChannelClient(mainProcessService.getChannel('logger'));
// Extension development test CLI: forward everything to main side
const loggers: ILogService[] = [];
if (environmentService.isExtensionDevelopment && !!environmentService.extensionTestsLocationURI) {
loggers.push(
new ConsoleLogInMainService(loggerClient, this.environmentService.configuration.logLevel)
);
}
// Normal logger: spdylog and console
else {
loggers.push(
new ConsoleLogService(this.environmentService.configuration.logLevel),
new SpdLogService(`renderer${this.configuration.windowId}`, environmentService.logsPath, this.environmentService.configuration.logLevel)
);
}
return new FollowerLogService(loggerClient, new MultiplexLogService(loggers));
}
}
export function main(configuration: INativeWindowConfiguration): Promise<void> {

View File

@@ -426,8 +426,20 @@ export class NativeWindow extends Disposable {
this.updateTouchbarMenu();
// Crash reporter (if enabled)
if (!this.environmentService.disableCrashReporter && product.crashReporter && product.appCenter && this.configurationService.getValue('telemetry.enableCrashReporter')) {
this.setupCrashReporter(product.crashReporter.companyName, product.crashReporter.productName, product.appCenter);
if (!this.environmentService.disableCrashReporter && this.configurationService.getValue('telemetry.enableCrashReporter')) {
const companyName = product.crashReporter?.companyName || 'Microsoft';
const productName = product.crashReporter?.productName || product.nameShort;
// With appCenter enabled, crashes will be uploaded
if (product.appCenter) {
this.setupCrashReporter(companyName, productName, product.appCenter, undefined);
}
// With a provided crash reporter directory, crashes
// will be stored only locally in that folder
else if (this.environmentService.crashReporterDirectory) {
this.setupCrashReporter(companyName, productName, undefined, this.environmentService.crashReporterDirectory);
}
}
}
@@ -540,13 +552,14 @@ export class NativeWindow extends Disposable {
}
}
private async setupCrashReporter(companyName: string, productName: string, appCenterConfig: typeof product.appCenter): Promise<void> {
if (!appCenterConfig) {
return;
private async setupCrashReporter(companyName: string, productName: string, appCenter: typeof product.appCenter, crashesDirectory: undefined): Promise<void>;
private async setupCrashReporter(companyName: string, productName: string, appCenter: undefined, crashesDirectory: string): Promise<void>;
private async setupCrashReporter(companyName: string, productName: string, appCenter: typeof product.appCenter | undefined, crashesDirectory: string | undefined): Promise<void> {
let submitURL: string | undefined = undefined;
if (appCenter) {
submitURL = isWindows ? appCenter[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? appCenter[`linux-x64`] : appCenter.darwin;
}
const appCenterURL = isWindows ? appCenterConfig[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64']
: isLinux ? appCenterConfig[`linux-x64`] : appCenterConfig.darwin;
const info = await this.telemetryService.getTelemetryInfo();
const crashReporterId = this.storageService.get(crashReporterIdStorageKey, StorageScope.GLOBAL)!;
@@ -554,11 +567,14 @@ export class NativeWindow extends Disposable {
const options: CrashReporterStartOptions = {
companyName,
productName,
submitURL: appCenterURL.concat('&uid=', crashReporterId, '&iid=', crashReporterId, '&sid=', info.sessionId),
submitURL: (submitURL?.concat('&uid=', crashReporterId, '&iid=', crashReporterId, '&sid=', info.sessionId)) || '',
extra: {
vscode_version: product.version,
vscode_commit: product.commit || ''
}
},
// If `crashesDirectory` is specified, we do not upload
uploadToServer: !crashesDirectory,
};
// start crash reporter in the main process first.