'use strict' ; import { WebSiteManagementMappers } from '@azure/arm-appservice' ; import * as vscode from 'vscode' ; import { registerAppServiceExtensionVariables } from 'vscode-azureappservice' ; import { AzExtTreeDataProvider , callWithTelemetryAndErrorHandling , createApiProvider , createAzExtOutputChannel , createExperimentationService , IActionContext , registerErrorHandler , registerEvent , registerReportIssueCommand , registerUIExtensionVariables } from 'vscode-azureextensionui' ; import { AzureExtensionApiProvider } from 'vscode-azureextensionui/api' ; import { createFunctionFromApi } from './commands/api/createFunctionFromApi' ; import { downloadAppSettingsFromApi } from './commands/api/downloadAppSettingsFromApi' ; import { revealTreeItem } from './commands/api/revealTreeItem' ; import { uploadAppSettingsFromApi } from './commands/api/uploadAppSettingsFromApi' ; import { runPostFunctionCreateStepsFromCache } from './commands/createFunction/FunctionCreateStepBase' ; import { registerCommands } from './commands/registerCommands' ; import { func } from './constants' ; import { FuncTaskProvider } from './debug/FuncTaskProvider' ; import { JavaDebugProvider } from './debug/JavaDebugProvider' ; import { NodeDebugProvider } from './debug/NodeDebugProvider' ; import { PowerShellDebugProvider } from './debug/PowerShellDebugProvider' ; import { PythonDebugProvider } from './debug/PythonDebugProvider' ; import { handleUri } from './downloadAzureProject/handleUri' ; import { ext } from './extensionVariables' ; import { registerFuncHostTaskEvents } from './funcCoreTools/funcHostTask' ; import { validateFuncCoreToolsIsLatest } from './funcCoreTools/validateFuncCoreToolsIsLatest' ; import { CentralTemplateProvider } from './templates/CentralTemplateProvider' ; import { AzureAccountTreeItemWithProjects } from './tree/AzureAccountTreeItemWithProjects' ; import { AzureFunctionsExtensionApi } from './vscode-azurefunctions.api' ; import { verifyVSCodeConfigOnActivate } from './vsCodeConfig/verifyVSCodeConfigOnActivate' ; export async function activateInternal ( context , perfStats , ignoreBundle ? ) { ext . context = context ; ext . ignoreBundle = ignoreBundle ; ext . outputChannel = createAzExtOutputChannel ( 'Azure Functions' , ext . prefix ) ; context . subscriptions . push ( ext . outputChannel ) ; registerUIExtensionVariables ( ext ) ; registerAppServiceExtensionVariables ( ext ) ; await callWithTelemetryAndErrorHandling ( 'azureFunctions.activate' , async ( activateContext ) => { activateContext . telemetry . properties . isActivationEvent = 'true' ; activateContext . telemetry . measurements . mainFileLoad = ( perfStats . loadEndTime - perfStats . loadStartTime ) / 1000 ; void runPostFunctionCreateStepsFromCache ( ) ; void validateFuncCoreToolsIsLatest ( ) ; ext . azureAccountTreeItem = new AzureAccountTreeItemWithProjects ( ) ; context . subscriptions . push ( ext . azureAccountTreeItem ) ; ext . tree = new AzExtTreeDataProvider ( ext . azureAccountTreeItem , 'azureFunctions.loadMore' ) ; ext . treeView = vscode . window . createTreeView ( 'azFuncTree' , { treeDataProvider : ext . tree , showCollapseAll : true } ) ; context . subscriptions . push ( ext . treeView ) ; const validateEventId = 'azureFunctions.validateFunctionProjects' ; void callWithTelemetryAndErrorHandling ( validateEventId , async ( actionContext ) => { await verifyVSCodeConfigOnActivate ( actionContext , vscode . workspace . workspaceFolders ) ; } ) ; registerEvent ( validateEventId , vscode . workspace . onDidChangeWorkspaceFolders , async ( actionContext , event ) => { await verifyVSCodeConfigOnActivate ( actionContext , event . added ) ; } ) ; const templateProvider = new CentralTemplateProvider ( ) ; ext . templateProvider . registerExtensionVariable ( templateProvider ) ; context . subscriptions . push ( templateProvider ) ; registerErrorHandler ( c => c . errorHandling . suppressReportIssue = true ) ; registerReportIssueCommand ( 'azureFunctions.reportIssue' ) ; registerCommands ( ) ; registerFuncHostTaskEvents ( ) ; const nodeDebugProvider = new NodeDebugProvider ( ) ; const pythonDebugProvider = new PythonDebugProvider ( ) ; const javaDebugProvider = new JavaDebugProvider ( ) ; const powershellDebugProvider = new PowerShellDebugProvider ( ) ; context . subscriptions . push ( vscode . debug . registerDebugConfigurationProvider ( 'node' , nodeDebugProvider ) ) ; context . subscriptions . push ( vscode . debug . registerDebugConfigurationProvider ( 'python' , pythonDebugProvider ) ) ; context . subscriptions . push ( vscode . debug . registerDebugConfigurationProvider ( 'java' , javaDebugProvider ) ) ; context . subscriptions . push ( vscode . debug . registerDebugConfigurationProvider ( 'PowerShell' , powershellDebugProvider ) ) ; context . subscriptions . push ( vscode . workspace . registerTaskProvider ( func , new FuncTaskProvider ( nodeDebugProvider , pythonDebugProvider , javaDebugProvider , powershellDebugProvider ) ) ) ; WebSiteManagementMappers . SiteConfig . type . modelProperties ! . powerShellVersion = { serializedName : 'powerShellVersion' , type : { name : 'String' } } ; WebSiteManagementMappers . SiteConfigResource . type . modelProperties ! . powerShellVersion = { serializedName : 'properties.powerShellVersion' , type : { name : 'String' } } ; context . subscriptions . push ( vscode . window . registerUriHandler ( { handleUri } ) ) ; ext . experimentationService = await createExperimentationService ( context ) ; } ) ; return createApiProvider ( [ < AzureFunctionsExtensionApi > { revealTreeItem , createFunction : createFunctionFromApi , downloadAppSettings : downloadAppSettingsFromApi , uploadAppSettings : uploadAppSettingsFromApi , apiVersion : '1.7.0' } ] ) ; } export function deactivateInternal ( ) { }