import { OpenDialogOptions , Uri , workspace } from "vscode" ; import { AzureWizardPromptStep } from "vscode-azureextensionui" ; import { IFunctionWizardContext } from "../IFunctionWizardContext" ; export class OpenAPIGetSpecificationFileStep extends AzureWizardPromptStep < IFunctionWizardContext > { public async prompt ( context ) { const openDialogOptions = { canSelectFiles : true , canSelectFolders : false , canSelectMany : false , title : 'Select OpenAPI (v2/v3) Specification File' , openLabel : 'Specification File' , filters : { JSON : [ 'json' , 'yaml' ] } } ; if ( workspace . workspaceFolders ) { openDialogOptions . defaultUri = Uri . file ( workspace . workspaceFolders [ 0 ] . uri . toString ( ) ) ; } context . openApiSpecificationFile = await context . ui . showOpenDialog ( openDialogOptions ) ; } public shouldPrompt ( context ) { return ! ! context . generateFromOpenAPI ; } }