add disabled features option (#8678)

This commit is contained in:
Anthony Dresser
2020-01-21 16:51:57 -08:00
committed by GitHub
parent 13d4ab22b1
commit f22dacadbe
4 changed files with 21 additions and 10 deletions

View File

@@ -127,8 +127,10 @@ actionRegistry.registerWorkbenchAction(builtinActionDescriptor, 'Extensions: Sho
const updateAllActionDescriptor = SyncActionDescriptor.create(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL);
actionRegistry.registerWorkbenchAction(updateAllActionDescriptor, 'Extensions: Update All Extensions', ExtensionsLabel);
const installVSIXActionDescriptor = SyncActionDescriptor.create(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL);
actionRegistry.registerWorkbenchAction(installVSIXActionDescriptor, 'Extensions: Install from VSIX...', ExtensionsLabel);
if (InstallVSIXAction.AVAILABLE) { // {{SQL CARBON EDIT}} add disable logic
const installVSIXActionDescriptor = SyncActionDescriptor.create(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL);
actionRegistry.registerWorkbenchAction(installVSIXActionDescriptor, 'Extensions: Install from VSIX...', ExtensionsLabel);
}
const disableAllAction = SyncActionDescriptor.create(DisableAllAction, DisableAllAction.ID, DisableAllAction.LABEL);
actionRegistry.registerWorkbenchAction(disableAllAction, 'Extensions: Disable All Installed Extensions', ExtensionsLabel);

View File

@@ -63,6 +63,7 @@ import { IFileDialogService, IDialogService } from 'vs/platform/dialogs/common/d
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; // {{SQL CARBON EDIT}}
import product from 'vs/platform/product/common/product';
export function toExtensionDescription(local: ILocalExtension): IExtensionDescription {
return {
@@ -86,7 +87,7 @@ const promptDownloadManually = (extension: IGalleryExtension | undefined, messag
return dialogService.show(Severity.Error, error.message, []);
} else {
const downloadUrl = (extension.assets.downloadPage && extension.assets.downloadPage.uri) || extension.assets.download.uri; // {{SQL CARBON EDIT}} Use the URI directly since we don't have a marketplace hosting the packages
notificationService.prompt(Severity.Error, message, [{
notificationService.prompt(Severity.Error, message, !InstallVSIXAction.AVAILABLE ? [] : [{
label: localize('download', "Download Manually"),
run: () => openerService.open(URI.parse(downloadUrl)).then(() => {
notificationService.prompt(
@@ -2871,6 +2872,7 @@ export class InstallVSIXAction extends Action {
static readonly ID = 'workbench.extensions.action.installVSIX';
static readonly LABEL = localize('installVSIX', "Install from VSIX...");
static readonly AVAILABLE = !(product.disabledFeatures?.indexOf(InstallVSIXAction.ID) >= 0); // {{SQL CARBON EDIT}} add available logic
constructor(
id = InstallVSIXAction.ID,
@@ -2965,6 +2967,10 @@ export class InstallVSIXAction extends Action {
}
// {{SQL CARBON EDIT}} - End
}
get enabled(): boolean { // {{SQL CARBON EDIT}} add enabled logic
return InstallVSIXAction.AVAILABLE;
}
}
export class ReinstallAction extends Action {

View File

@@ -114,13 +114,15 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
// Menu
(function registerMenu(): void {
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { // {{SQL CARBON EDIT}} - Add install VSIX menu item
group: '5.1_installExtension',
command: {
id: InstallVSIXAction.ID,
title: nls.localize({ key: 'miinstallVsix', comment: ['&& denotes a mnemonic'] }, "Install Extension from VSIX Package")
}
});
if (InstallVSIXAction.AVAILABLE) {
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { // {{SQL CARBON EDIT}} - Add install VSIX menu item
group: '5.1_installExtension',
command: {
id: InstallVSIXAction.ID,
title: nls.localize({ key: 'miinstallVsix', comment: ['&& denotes a mnemonic'] }, "Install Extension from VSIX Package")
}
});
}
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '6_close',