Add prompt to install required extensions for resource deployment (#14870)

This commit is contained in:
Charles Gagnon
2021-03-25 16:41:08 -07:00
committed by GitHub
parent 15f7b12849
commit b7e982e78a
3 changed files with 83 additions and 2 deletions

View File

@@ -7,8 +7,10 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { ExtensionsLabel } from 'vs/platform/extensionManagement/common/extensionManagement';
import { ExtensionsLabel, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { OpenExtensionAuthoringDocsAction } from 'sql/workbench/contrib/extensions/browser/extensionsActions';
import { localize } from 'vs/nls';
import { deepClone } from 'vs/base/common/objects';
// Global Actions
const actionRegistry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions);
@@ -23,3 +25,27 @@ CommandsRegistry.registerCommand('azdata.extension.open', (accessor: ServicesAcc
throw new Error('Extension id is not provided');
}
});
CommandsRegistry.registerCommand({
id: 'workbench.extensions.getExtensionFromGallery',
description: {
description: localize('workbench.extensions.getExtensionFromGallery.description', "Gets extension information from the gallery"),
args: [
{
name: localize('workbench.extensions.getExtensionFromGallery.arg.name', "Extension id"),
schema: {
'type': ['string']
}
}
]
},
handler: async (accessor, arg: string) => {
const extensionGalleryService = accessor.get(IExtensionGalleryService);
const extension = await extensionGalleryService.getCompatibleExtension({ id: arg });
if (extension) {
return deepClone(extension);
} else {
throw new Error(localize('notFound', "Extension '{0}' not found.", arg));
}
}
});