in src/extension.ts [52:143]
await callWithTelemetryAndErrorHandling('activate', (activateContext: IActionContext) => {
activateContext.telemetry.properties.isActivationEvent = 'true';
activateContext.telemetry.measurements.mainFileLoad = (perfStats.loadEndTime - perfStats.loadStartTime) / 1000;
const azureAccountTreeItem = new AzureAccountTreeItem();
context.subscriptions.push(azureAccountTreeItem);
ext.tree = new AzExtTreeDataProvider(azureAccountTreeItem, 'azureStorage.loadMore');
ext.treeView = vscode.window.createTreeView(ext.prefix, { treeDataProvider: ext.tree, showCollapseAll: true, canSelectMany: true });
context.subscriptions.push(ext.treeView);
registerBlobActionHandlers();
registerBlobContainerActionHandlers();
registerBlobContainerGroupActionHandlers();
registerFileActionHandlers();
registerDirectoryActionHandlers();
registerFileShareActionHandlers();
registerFileShareGroupActionHandlers();
registerQueueActionHandlers();
registerQueueGroupActionHandlers();
registerStorageAccountActionHandlers();
registerTableActionHandlers();
registerTableGroupActionHandlers();
ext.azureStorageFS = new AzureStorageFS();
context.subscriptions.push(vscode.workspace.registerFileSystemProvider('azurestorage', ext.azureStorageFS, { isCaseSensitive: true }));
context.subscriptions.push(vscode.workspace.registerTextDocumentContentProvider('azurestorage', ext.azureStorageFS));
registerCommand('azureStorage.showOutputChannel', () => { ext.outputChannel.show(); });
registerCommand('azureStorage.openInFileExplorer', async (actionContext: IActionContext, treeItem?: BlobContainerTreeItem | FileShareTreeItem) => {
if (!treeItem) {
treeItem = <BlobContainerTreeItem | FileShareTreeItem>(await ext.tree.showTreeItemPicker([BlobContainerTreeItem.contextValue, FileShareTreeItem.contextValue], actionContext));
}
const wizardContext: IOpenInFileExplorerWizardContext = Object.assign(actionContext, { treeItem });
if (treeItem.root.isEmulated) {
wizardContext.openBehavior = 'OpenInNewWindow';
}
const wizard: AzureWizard<IOpenInFileExplorerWizardContext> = new AzureWizard(wizardContext, {
promptSteps: [new OpenBehaviorStep()],
executeSteps: [new OpenTreeItemStep()]
});
await wizard.prompt();
await wizard.execute();
});
registerCommand('azureStorage.refresh', async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => ext.tree.refresh(actionContext, treeItem));
registerCommand('azureStorage.loadMore', async (actionContext: IActionContext, treeItem: AzExtTreeItem) => await ext.tree.loadMore(treeItem, actionContext));
registerCommand('azureStorage.copyUrl', (_actionContext: IActionContext, treeItem: AzExtTreeItem & ICopyUrl) => treeItem.copyUrl());
registerCommand('azureStorage.selectSubscriptions', () => commands.executeCommand("azure-account.selectSubscriptions"));
registerCommand("azureStorage.openInPortal", async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => {
if (!treeItem) {
treeItem = <StorageAccountTreeItem>await ext.tree.showTreeItemPicker(StorageAccountTreeItem.contextValue, actionContext);
}
await openInPortal(treeItem, treeItem.fullId);
});
registerCommand("azureStorage.configureStaticWebsite", async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => {
const accountTreeItem = await selectStorageAccountTreeItemForCommand(
treeItem,
actionContext,
{
mustBeWebsiteCapable: true,
configureWebsite: false
});
await accountTreeItem.configureStaticWebsite(actionContext);
});
registerCommand("azureStorage.disableStaticWebsite", async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => {
const accountTreeItem = await selectStorageAccountTreeItemForCommand(
treeItem,
actionContext,
{
mustBeWebsiteCapable: false,
configureWebsite: false
});
await accountTreeItem.disableStaticWebsite(actionContext);
});
registerCommand("azureStorage.createGpv2Account", createStorageAccount);
registerCommand("azureStorage.createGpv2AccountAdvanced", createStorageAccountAdvanced);
registerCommand('azureStorage.browseStaticWebsite', async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => {
const accountTreeItem = await selectStorageAccountTreeItemForCommand(
treeItem,
actionContext,
{
mustBeWebsiteCapable: true,
configureWebsite: false
});
await accountTreeItem.browseStaticWebsite(actionContext);
});
// Suppress "Report an Issue" button for all errors in favor of the command
registerErrorHandler(c => c.errorHandling.suppressReportIssue = true);
registerReportIssueCommand('azureStorage.reportIssue');
});