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

@@ -56,6 +56,7 @@ export interface IProductConfiguration {
readonly recommendedExtensionsByScenario: { [area: string]: Array<string> }; // {{SQL CARBON EDIT}} readonly recommendedExtensionsByScenario: { [area: string]: Array<string> }; // {{SQL CARBON EDIT}}
readonly vscodeVersion: string; // {{SQL CARBON EDIT}} add vscode version readonly vscodeVersion: string; // {{SQL CARBON EDIT}} add vscode version
readonly gettingStartedUrl: string; // {SQL CARBON EDIT} readonly gettingStartedUrl: string; // {SQL CARBON EDIT}
readonly disabledFeatures?: string[]; // {{SQL CARBON EDIT}}
readonly crashReporter?: { readonly crashReporter?: {
readonly companyName: string; readonly companyName: string;

View File

@@ -127,8 +127,10 @@ actionRegistry.registerWorkbenchAction(builtinActionDescriptor, 'Extensions: Sho
const updateAllActionDescriptor = SyncActionDescriptor.create(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL); const updateAllActionDescriptor = SyncActionDescriptor.create(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL);
actionRegistry.registerWorkbenchAction(updateAllActionDescriptor, 'Extensions: Update All Extensions', ExtensionsLabel); actionRegistry.registerWorkbenchAction(updateAllActionDescriptor, 'Extensions: Update All Extensions', ExtensionsLabel);
if (InstallVSIXAction.AVAILABLE) { // {{SQL CARBON EDIT}} add disable logic
const installVSIXActionDescriptor = SyncActionDescriptor.create(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL); const installVSIXActionDescriptor = SyncActionDescriptor.create(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL);
actionRegistry.registerWorkbenchAction(installVSIXActionDescriptor, 'Extensions: Install from VSIX...', ExtensionsLabel); actionRegistry.registerWorkbenchAction(installVSIXActionDescriptor, 'Extensions: Install from VSIX...', ExtensionsLabel);
}
const disableAllAction = SyncActionDescriptor.create(DisableAllAction, DisableAllAction.ID, DisableAllAction.LABEL); const disableAllAction = SyncActionDescriptor.create(DisableAllAction, DisableAllAction.ID, DisableAllAction.LABEL);
actionRegistry.registerWorkbenchAction(disableAllAction, 'Extensions: Disable All Installed Extensions', ExtensionsLabel); 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 { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; // {{SQL CARBON EDIT}} 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 { export function toExtensionDescription(local: ILocalExtension): IExtensionDescription {
return { return {
@@ -86,7 +87,7 @@ const promptDownloadManually = (extension: IGalleryExtension | undefined, messag
return dialogService.show(Severity.Error, error.message, []); return dialogService.show(Severity.Error, error.message, []);
} else { } 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 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"), label: localize('download', "Download Manually"),
run: () => openerService.open(URI.parse(downloadUrl)).then(() => { run: () => openerService.open(URI.parse(downloadUrl)).then(() => {
notificationService.prompt( notificationService.prompt(
@@ -2871,6 +2872,7 @@ export class InstallVSIXAction extends Action {
static readonly ID = 'workbench.extensions.action.installVSIX'; static readonly ID = 'workbench.extensions.action.installVSIX';
static readonly LABEL = localize('installVSIX', "Install from VSIX..."); static readonly LABEL = localize('installVSIX', "Install from VSIX...");
static readonly AVAILABLE = !(product.disabledFeatures?.indexOf(InstallVSIXAction.ID) >= 0); // {{SQL CARBON EDIT}} add available logic
constructor( constructor(
id = InstallVSIXAction.ID, id = InstallVSIXAction.ID,
@@ -2965,6 +2967,10 @@ export class InstallVSIXAction extends Action {
} }
// {{SQL CARBON EDIT}} - End // {{SQL CARBON EDIT}} - End
} }
get enabled(): boolean { // {{SQL CARBON EDIT}} add enabled logic
return InstallVSIXAction.AVAILABLE;
}
} }
export class ReinstallAction extends Action { export class ReinstallAction extends Action {

View File

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