import { window } from 'vscode' ; import { AzureWizard , IActionContext } from 'vscode-azureextensionui' ; import { funcVersionSetting , ProjectLanguage , projectLanguageSetting , projectOpenBehaviorSetting , projectTemplateKeySetting } from '../../constants' ; import { addLocalFuncTelemetry } from '../../funcCoreTools/getLocalFuncCoreToolsVersion' ; import { tryGetLocalFuncVersion } from '../../funcCoreTools/tryGetLocalFuncVersion' ; import { latestGAVersion , tryParseFuncVersion } from '../../FuncVersion' ; import { localize } from '../../localize' ; import * as api from '../../vscode-azurefunctions.api' ; import { getGlobalSetting , getWorkspaceSetting } from '../../vsCodeConfig/settings' ; import { IFunctionWizardContext } from '../createFunction/IFunctionWizardContext' ; import { FolderListStep } from './FolderListStep' ; import { NewProjectLanguageStep } from './NewProjectLanguageStep' ; import { OpenBehaviorStep } from './OpenBehaviorStep' ; import { OpenFolderStep } from './OpenFolderStep' ; deprecated export async function createNewProjectFromCommand ( context , folderPath ? , language ? , version ? , openFolder = true , templateId ? , functionName ? , functionSettings ? ) { await createNewProjectInternal ( context , { folderPath , templateId , functionName , functionSettings , suppressOpenFolder : ! openFolder , language : < api . ProjectLanguage > language , version : < api . ProjectVersion > version } ) ; } export async function createNewProjectInternal ( context , options ) { addLocalFuncTelemetry ( context , undefined ) ; const language = < ProjectLanguage > options . language || getGlobalSetting ( projectLanguageSetting ) ; const version = options . version || getGlobalSetting ( funcVersionSetting ) || await tryGetLocalFuncVersion ( context , undefined ) || latestGAVersion ; const projectTemplateKey = getGlobalSetting ( projectTemplateKeySetting ) ; const wizardContext = Object . assign ( context , options , { language , version : tryParseFuncVersion ( version ) , projectTemplateKey } ) ; if ( options . folderPath ) { FolderListStep . setProjectPath ( wizardContext , options . folderPath ) ; } if ( options . suppressOpenFolder ) { wizardContext . openBehavior = 'DontOpen' ; } else if ( ! wizardContext . openBehavior ) { wizardContext . openBehavior = getWorkspaceSetting ( projectOpenBehaviorSetting ) ; context . telemetry . properties . openBehaviorFromSetting = String ( ! ! wizardContext . openBehavior ) ; } const wizard = new AzureWizard ( wizardContext , { title : localize ( 'createNewProject' , 'Create new project' ) , promptSteps : [ new FolderListStep ( ) , new NewProjectLanguageStep ( options . templateId , options . functionSettings ) , new OpenBehaviorStep ( ) ] , executeSteps : [ new OpenFolderStep ( ) ] } ) ; await wizard . prompt ( ) ; await wizard . execute ( ) ; void window . showInformationMessage ( localize ( 'finishedCreating' , 'Finished creating project.' ) ) ; }