Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)

* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463

* fix config changes

* fix strictnull checks
This commit is contained in:
Anthony Dresser
2019-09-15 22:38:26 -07:00
committed by GitHub
parent fa6c52699e
commit ea0f9e6ce9
1226 changed files with 21541 additions and 17633 deletions

View File

@@ -70,12 +70,11 @@ const TextInputActions: IAction[] = [
export class ElectronWindow extends Disposable {
private touchBarMenu?: IMenu;
private touchBarUpdater: RunOnceScheduler;
private touchBarMenu: IMenu | undefined;
private readonly touchBarDisposables = this._register(new DisposableStore());
private lastInstalledTouchedBar: ICommandAction[][];
private lastInstalledTouchedBar: ICommandAction[][] | undefined;
private previousConfiguredZoomLevel: number;
private previousConfiguredZoomLevel: number | undefined;
private addFoldersScheduler: RunOnceScheduler;
private pendingFoldersToAdd: URI[];
@@ -325,24 +324,21 @@ export class ElectronWindow extends Disposable {
this.integrityService.isPure().then(res => this.titleService.updateProperties({ isPure: res.isPure }));
// Root warning
this.lifecycleService.when(LifecyclePhase.Restored).then(() => {
let isAdminPromise: Promise<boolean>;
this.lifecycleService.when(LifecyclePhase.Restored).then(async () => {
let isAdmin: boolean;
if (isWindows) {
isAdminPromise = import('native-is-elevated').then(isElevated => isElevated()); // not using async here due to https://github.com/microsoft/vscode/issues/74321
isAdmin = (await import('native-is-elevated'))();
} else {
isAdminPromise = Promise.resolve(isRootUser());
isAdmin = isRootUser();
}
return isAdminPromise.then(isAdmin => {
// Update title
this.titleService.updateProperties({ isAdmin });
// Update title
this.titleService.updateProperties({ isAdmin });
// Show warning message (unix only)
if (isAdmin && !isWindows) {
this.notificationService.warn(nls.localize('runningAsRoot', "It is not recommended to run {0} as root user.", product.nameShort));
}
});
// Show warning message (unix only)
if (isAdmin && !isWindows) {
this.notificationService.warn(nls.localize('runningAsRoot', "It is not recommended to run {0} as root user.", product.nameShort));
}
});
// Touchbar menu (if enabled)
@@ -350,7 +346,7 @@ export class ElectronWindow extends Disposable {
// Crash reporter (if enabled)
if (!this.environmentService.disableCrashReporter && product.crashReporter && product.hockeyApp && this.configurationService.getValue('telemetry.enableCrashReporter')) {
this.setupCrashReporter();
this.setupCrashReporter(product.crashReporter.companyName, product.crashReporter.productName, product.hockeyApp);
}
}
@@ -397,16 +393,15 @@ export class ElectronWindow extends Disposable {
this.touchBarMenu = undefined;
// Create new (delayed)
this.touchBarUpdater = new RunOnceScheduler(() => this.doUpdateTouchbarMenu(), 300);
this.touchBarDisposables.add(this.touchBarUpdater);
this.touchBarUpdater.schedule();
const scheduler: RunOnceScheduler = this.touchBarDisposables.add(new RunOnceScheduler(() => this.doUpdateTouchbarMenu(scheduler), 300));
scheduler.schedule();
}
private doUpdateTouchbarMenu(): void {
private doUpdateTouchbarMenu(scheduler: RunOnceScheduler): void {
if (!this.touchBarMenu) {
this.touchBarMenu = this.editorService.invokeWithinEditorContext(accessor => this.menuService.createMenu(MenuId.TouchBarContext, accessor.get(IContextKeyService)));
this.touchBarDisposables.add(this.touchBarMenu);
this.touchBarDisposables.add(this.touchBarMenu.onDidChange(() => this.touchBarUpdater.schedule()));
this.touchBarDisposables.add(this.touchBarMenu.onDidChange(() => scheduler.schedule()));
}
const actions: Array<MenuItemAction | Separator> = [];
@@ -454,13 +449,16 @@ export class ElectronWindow extends Disposable {
}
}
private async setupCrashReporter(): Promise<void> {
private async setupCrashReporter(companyName: string, productName: string, hockeyAppConfig: typeof product.hockeyApp): Promise<void> {
if (!hockeyAppConfig) {
return;
}
// base options with product info
const options = {
companyName: product.crashReporter.companyName,
productName: product.crashReporter.productName,
submitURL: isWindows ? product.hockeyApp[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? product.hockeyApp[`linux-x64`] : product.hockeyApp.darwin,
companyName,
productName,
submitURL: isWindows ? hockeyAppConfig[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? hockeyAppConfig[`linux-x64`] : hockeyAppConfig.darwin,
extra: {
vscode_version: pkg.version,
vscode_commit: product.commit