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

@@ -28,7 +28,9 @@ export class KeybindingsReferenceAction extends Action {
}
run(): Promise<void> {
this.openerService.open(URI.parse(KeybindingsReferenceAction.URL));
if (KeybindingsReferenceAction.URL) {
this.openerService.open(URI.parse(KeybindingsReferenceAction.URL));
}
return Promise.resolve();
}
@@ -51,7 +53,9 @@ export class OpenDocumentationUrlAction extends Action {
}
run(): Promise<void> {
this.openerService.open(URI.parse(OpenDocumentationUrlAction.URL));
if (OpenDocumentationUrlAction.URL) {
this.openerService.open(URI.parse(OpenDocumentationUrlAction.URL));
}
return Promise.resolve();
}
@@ -74,7 +78,9 @@ export class OpenIntroductoryVideosUrlAction extends Action {
}
run(): Promise<void> {
this.openerService.open(URI.parse(OpenIntroductoryVideosUrlAction.URL));
if (OpenIntroductoryVideosUrlAction.URL) {
this.openerService.open(URI.parse(OpenIntroductoryVideosUrlAction.URL));
}
return Promise.resolve();
}
@@ -97,7 +103,10 @@ export class OpenTipsAndTricksUrlAction extends Action {
}
run(): Promise<void> {
this.openerService.open(URI.parse(OpenTipsAndTricksUrlAction.URL));
if (OpenTipsAndTricksUrlAction.URL) {
this.openerService.open(URI.parse(OpenTipsAndTricksUrlAction.URL));
}
return Promise.resolve();
}
}
@@ -106,31 +115,29 @@ export class OpenNewsletterSignupUrlAction extends Action {
static readonly ID = 'workbench.action.openNewsletterSignupUrl';
static readonly LABEL = nls.localize('newsletterSignup', "Signup for the VS Code Newsletter");
private telemetryService: ITelemetryService;
private static readonly URL = product.newsletterSignupUrl;
static readonly AVAILABLE = !!OpenNewsletterSignupUrlAction.URL;
static readonly AVAILABLE = !!product.newsletterSignupUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@ITelemetryService telemetryService: ITelemetryService
@ITelemetryService private readonly telemetryService: ITelemetryService
) {
super(id, label);
this.telemetryService = telemetryService;
}
async run(): Promise<void> {
const info = await this.telemetryService.getTelemetryInfo();
this.openerService.open(URI.parse(`${OpenNewsletterSignupUrlAction.URL}?machineId=${encodeURIComponent(info.machineId)}`));
this.openerService.open(URI.parse(`${product.newsletterSignupUrl}?machineId=${encodeURIComponent(info.machineId)}`));
}
}
export class OpenTwitterUrlAction extends Action {
static readonly ID = 'workbench.action.openTwitterUrl';
static LABEL = nls.localize('openTwitterUrl', "Join Us on Twitter", product.applicationName);
static readonly LABEL = nls.localize('openTwitterUrl', "Join Us on Twitter", product.applicationName);
static readonly AVAILABLE = !!product.twitterUrl;
constructor(
id: string,
@@ -152,7 +159,8 @@ export class OpenTwitterUrlAction extends Action {
export class OpenRequestFeatureUrlAction extends Action {
static readonly ID = 'workbench.action.openRequestFeatureUrl';
static LABEL = nls.localize('openUserVoiceUrl', "Search Feature Requests");
static readonly LABEL = nls.localize('openUserVoiceUrl', "Search Feature Requests");
static readonly AVAILABLE = !!product.requestFeatureUrl;
constructor(
id: string,
@@ -174,7 +182,8 @@ export class OpenRequestFeatureUrlAction extends Action {
export class OpenLicenseUrlAction extends Action {
static readonly ID = 'workbench.action.openLicenseUrl';
static LABEL = nls.localize('openLicenseUrl', "View License");
static readonly LABEL = nls.localize('openLicenseUrl', "View License");
static readonly AVAILABLE = !!product.licenseUrl;
constructor(
id: string,
@@ -201,7 +210,8 @@ export class OpenLicenseUrlAction extends Action {
export class OpenPrivacyStatementUrlAction extends Action {
static readonly ID = 'workbench.action.openPrivacyStatementUrl';
static LABEL = nls.localize('openPrivacyStatement', "Privacy Statement");
static readonly LABEL = nls.localize('openPrivacyStatement', "Privacy Statement");
static readonly AVAILABE = !!product.privacyStatementUrl;
constructor(
id: string,

View File

@@ -148,10 +148,21 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNewsletterSignupUrlAction, OpenNewsletterSignupUrlAction.ID, OpenNewsletterSignupUrlAction.LABEL), 'Help: Tips and Tricks', helpCategory);
}
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenTwitterUrlAction, OpenTwitterUrlAction.ID, OpenTwitterUrlAction.LABEL), 'Help: Join Us on Twitter', helpCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRequestFeatureUrlAction, OpenRequestFeatureUrlAction.ID, OpenRequestFeatureUrlAction.LABEL), 'Help: Search Feature Requests', helpCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenLicenseUrlAction, OpenLicenseUrlAction.ID, OpenLicenseUrlAction.LABEL), 'Help: View License', helpCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPrivacyStatementUrlAction, OpenPrivacyStatementUrlAction.ID, OpenPrivacyStatementUrlAction.LABEL), 'Help: Privacy Statement', helpCategory);
if (OpenTwitterUrlAction.AVAILABLE) {
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenTwitterUrlAction, OpenTwitterUrlAction.ID, OpenTwitterUrlAction.LABEL), 'Help: Join Us on Twitter', helpCategory);
}
if (OpenRequestFeatureUrlAction.AVAILABLE) {
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRequestFeatureUrlAction, OpenRequestFeatureUrlAction.ID, OpenRequestFeatureUrlAction.LABEL), 'Help: Search Feature Requests', helpCategory);
}
if (OpenLicenseUrlAction.AVAILABLE) {
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenLicenseUrlAction, OpenLicenseUrlAction.ID, OpenLicenseUrlAction.LABEL), 'Help: View License', helpCategory);
}
if (OpenPrivacyStatementUrlAction.AVAILABE) {
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPrivacyStatementUrlAction, OpenPrivacyStatementUrlAction.ID, OpenPrivacyStatementUrlAction.LABEL), 'Help: Privacy Statement', helpCategory);
}
})();
})();
@@ -266,14 +277,16 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
// Help
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '1_welcome',
command: {
id: OpenDocumentationUrlAction.ID,
title: nls.localize({ key: 'miDocumentation', comment: ['&& denotes a mnemonic'] }, "&&Documentation")
},
order: 3
});
if (OpenDocumentationUrlAction.AVAILABLE) {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '1_welcome',
command: {
id: OpenDocumentationUrlAction.ID,
title: nls.localize({ key: 'miDocumentation', comment: ['&& denotes a mnemonic'] }, "&&Documentation")
},
order: 3
});
}
/* // {{SQL CARBON EDIT}} - Disable unused menu item
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
@@ -286,51 +299,61 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
});
// Reference
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '2_reference',
command: {
id: KeybindingsReferenceAction.ID,
title: nls.localize({ key: 'miKeyboardShortcuts', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts Reference")
},
order: 1
});
if (KeybindingsReferenceAction.AVAILABLE) {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '2_reference',
command: {
id: KeybindingsReferenceAction.ID,
title: nls.localize({ key: 'miKeyboardShortcuts', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts Reference")
},
order: 1
});
}
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '2_reference',
command: {
id: OpenIntroductoryVideosUrlAction.ID,
title: nls.localize({ key: 'miIntroductoryVideos', comment: ['&& denotes a mnemonic'] }, "Introductory &&Videos")
},
order: 2
});
if (OpenIntroductoryVideosUrlAction.AVAILABLE) {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '2_reference',
command: {
id: OpenIntroductoryVideosUrlAction.ID,
title: nls.localize({ key: 'miIntroductoryVideos', comment: ['&& denotes a mnemonic'] }, "Introductory &&Videos")
},
order: 2
});
}
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '2_reference',
command: {
id: OpenTipsAndTricksUrlAction.ID,
title: nls.localize({ key: 'miTipsAndTricks', comment: ['&& denotes a mnemonic'] }, "Tips and Tri&&cks")
},
order: 3
});
if (OpenTipsAndTricksUrlAction.AVAILABLE) {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '2_reference',
command: {
id: OpenTipsAndTricksUrlAction.ID,
title: nls.localize({ key: 'miTipsAndTricks', comment: ['&& denotes a mnemonic'] }, "Tips and Tri&&cks")
},
order: 3
});
}
// Feedback
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '3_feedback',
command: {
id: OpenTwitterUrlAction.ID,
title: nls.localize({ key: 'miTwitter', comment: ['&& denotes a mnemonic'] }, "&&Join Us on Twitter")
},
order: 1
});
if (OpenTwitterUrlAction.AVAILABLE) {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '3_feedback',
command: {
id: OpenTwitterUrlAction.ID,
title: nls.localize({ key: 'miTwitter', comment: ['&& denotes a mnemonic'] }, "&&Join Us on Twitter")
},
order: 1
});
}
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '3_feedback',
command: {
id: OpenRequestFeatureUrlAction.ID,
title: nls.localize({ key: 'miUserVoice', comment: ['&& denotes a mnemonic'] }, "&&Search Feature Requests")
},
order: 2
});
if (OpenRequestFeatureUrlAction.AVAILABLE) {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '3_feedback',
command: {
id: OpenRequestFeatureUrlAction.ID,
title: nls.localize({ key: 'miUserVoice', comment: ['&& denotes a mnemonic'] }, "&&Search Feature Requests")
},
order: 2
});
}
*/
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
@@ -343,23 +366,27 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
});
// Legal
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '4_legal',
command: {
id: OpenLicenseUrlAction.ID,
title: nls.localize({ key: 'miLicense', comment: ['&& denotes a mnemonic'] }, "View &&License")
},
order: 1
});
if (OpenLicenseUrlAction.AVAILABLE) {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '4_legal',
command: {
id: OpenLicenseUrlAction.ID,
title: nls.localize({ key: 'miLicense', comment: ['&& denotes a mnemonic'] }, "View &&License")
},
order: 1
});
}
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '4_legal',
command: {
id: OpenPrivacyStatementUrlAction.ID,
title: nls.localize({ key: 'miPrivacyStatement', comment: ['&& denotes a mnemonic'] }, "Privac&&y Statement")
},
order: 2
});
if (OpenPrivacyStatementUrlAction.AVAILABE) {
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: '4_legal',
command: {
id: OpenPrivacyStatementUrlAction.ID,
title: nls.localize({ key: 'miPrivacyStatement', comment: ['&& denotes a mnemonic'] }, "Privac&&y Statement")
},
order: 2
});
}
// Tools
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {

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