import { ExtensionContext , TreeView } from "vscode" ; import { AzExtTreeDataProvider , AzExtTreeItem , IActionContext , IAzExtOutputChannel , IExperimentationServiceAdapter } from "vscode-azureextensionui" ; import { func } from "./constants" ; import { CentralTemplateProvider } from "./templates/CentralTemplateProvider" ; import { AzureAccountTreeItemWithProjects } from "./tree/AzureAccountTreeItemWithProjects" ; /**
 * Used for extensionVariables that can also be set per-action
 */ class ActionVariable < T > { private _extensionVariable : T | undefined ; private _key : string ; public constructor ( key ) { this . _key = key ; } public registerActionVariable ( value , context ) { context [ this . _key ] = value ; } public registerExtensionVariable ( value ) { this . _extensionVariable = value ; } public get ( context ) { if ( context [ this . _key ] !== undefined ) { return < T > context [ this . _key ] ; } else if ( this . _extensionVariable !== undefined ) { return < T > this . _extensionVariable ; } else { throw new Error ( `Internal Error: "${ this . _key }" must be registered before use.` ) ; } } } /**
 * Namespace for common variables used throughout the extension. They must be initialized in the activate() method of extension.ts
 */ export namespace ext { export let context ; export let tree ; export let treeView ; export let azureAccountTreeItem ; export let outputChannel ; export let defaultFuncCliPath = func ; export let ignoreBundle ; export const prefix = 'azureFunctions' ; export let experimentationService ; export const templateProvider = new ActionVariable < CentralTemplateProvider > ( '_centralTemplateProvider' ) ; } export enum TemplateSource { Backup = 'Backup' , Latest = 'Latest' , Staging = 'Staging' }