Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)

* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973

* disable strict null check
This commit is contained in:
Anthony Dresser
2019-07-15 22:35:46 -07:00
committed by GitHub
parent f720ec642f
commit 0b7e7ddbf9
2406 changed files with 59140 additions and 35464 deletions

View File

@@ -21,14 +21,14 @@ import { IWorkbenchThemeService, VS_HC_THEME } from 'vs/workbench/services/theme
import * as browser from 'vs/base/browser/browser';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IResourceInput } from 'vs/platform/editor/common/editor';
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/keybindingService';
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/nativeKeymapService';
import { ipcRenderer as ipc, webFrame, crashReporter, Event } from 'electron';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction } from 'vs/platform/actions/common/actions';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { fillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { RunOnceScheduler } from 'vs/base/common/async';
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
import { IDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { LifecyclePhase, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { IIntegrityService } from 'vs/workbench/services/integrity/common/integrity';
@@ -61,7 +61,7 @@ export class ElectronWindow extends Disposable {
private touchBarMenu?: IMenu;
private touchBarUpdater: RunOnceScheduler;
private touchBarDisposables: IDisposable[];
private readonly touchBarDisposables = this._register(new DisposableStore());
private lastInstalledTouchedBar: ICommandAction[][];
private previousConfiguredZoomLevel: number;
@@ -95,8 +95,6 @@ export class ElectronWindow extends Disposable {
) {
super();
this.touchBarDisposables = [];
this.pendingFoldersToAdd = [];
this.addFoldersScheduler = this._register(new RunOnceScheduler(() => this.doAddFolders(), 100));
@@ -314,22 +312,24 @@ export class ElectronWindow extends Disposable {
this.integrityService.isPure().then(res => this.titleService.updateProperties({ isPure: res.isPure }));
// Root warning
this.lifecycleService.when(LifecyclePhase.Restored).then(async () => {
let isAdmin: boolean;
this.lifecycleService.when(LifecyclePhase.Restored).then(() => {
let isAdminPromise: Promise<boolean>;
if (isWindows) {
const isElevated = await import('native-is-elevated');
isAdmin = isElevated();
isAdminPromise = import('native-is-elevated').then(isElevated => isElevated()); // not using async here due to https://github.com/microsoft/vscode/issues/74321
} else {
isAdmin = isRootUser();
isAdminPromise = Promise.resolve(isRootUser());
}
// Update title
this.titleService.updateProperties({ isAdmin });
return isAdminPromise.then(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));
}
// 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));
}
});
});
// Touchbar menu (if enabled)
@@ -350,26 +350,26 @@ export class ElectronWindow extends Disposable {
}
// Dispose old
this.touchBarDisposables = dispose(this.touchBarDisposables);
this.touchBarDisposables.clear();
this.touchBarMenu = undefined;
// Create new (delayed)
this.touchBarUpdater = new RunOnceScheduler(() => this.doUpdateTouchbarMenu(), 300);
this.touchBarDisposables.push(this.touchBarUpdater);
this.touchBarDisposables.add(this.touchBarUpdater);
this.touchBarUpdater.schedule();
}
private doUpdateTouchbarMenu(): void {
if (!this.touchBarMenu) {
this.touchBarMenu = this.editorService.invokeWithinEditorContext(accessor => this.menuService.createMenu(MenuId.TouchBarContext, accessor.get(IContextKeyService)));
this.touchBarDisposables.push(this.touchBarMenu);
this.touchBarDisposables.push(this.touchBarMenu.onDidChange(() => this.touchBarUpdater.schedule()));
this.touchBarDisposables.add(this.touchBarMenu);
this.touchBarDisposables.add(this.touchBarMenu.onDidChange(() => this.touchBarUpdater.schedule()));
}
const actions: Array<MenuItemAction | Separator> = [];
// Fill actions into groups respecting order
fillInActionBarActions(this.touchBarMenu, undefined, actions);
this.touchBarDisposables.add(createAndFillInActionBarActions(this.touchBarMenu, undefined, actions));
// Convert into command action multi array
const items: ICommandAction[][] = [];
@@ -408,7 +408,7 @@ export class ElectronWindow extends Disposable {
const options = {
companyName: product.crashReporter.companyName,
productName: product.crashReporter.productName,
submitURL: isWindows ? product.hockeyApp[`win32-${process.arch}`] : isLinux ? product.hockeyApp[`linux-${process.arch}`] : product.hockeyApp.darwin,
submitURL: isWindows ? product.hockeyApp[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? product.hockeyApp[`linux-x64`] : product.hockeyApp.darwin,
extra: {
vscode_version: pkg.version,
vscode_commit: product.commit
@@ -531,10 +531,4 @@ export class ElectronWindow extends Disposable {
// Otherwise open all
return this.editorService.openEditors(resources);
}
dispose(): void {
this.touchBarDisposables = dispose(this.touchBarDisposables);
super.dispose();
}
}