import { commands , Uri , workspace , WorkspaceFolder } from 'vscode' ; import { AzureWizardExecuteStep } from 'vscode-azureextensionui' ; import { IProjectWizardContext } from './IProjectWizardContext' ; export class OpenFolderStep extends AzureWizardExecuteStep < IProjectWizardContext > { public priority : number = 250 ; public async execute ( context ) { const openFolders = workspace . workspaceFolders || [ ] ; if ( context . openBehavior === 'AddToWorkspace' && openFolders . length === 0 ) { context . openBehavior = 'OpenInCurrentWindow' ; } const uri = Uri . file ( context . workspacePath ) ; if ( context . openBehavior === 'AddToWorkspace' ) { workspace . updateWorkspaceFolders ( openFolders . length , 0 , { uri : uri } ) ; } else { await commands . executeCommand ( 'vscode.openFolder' , uri , context . openBehavior === 'OpenInNewWindow' ) ; } } public shouldExecute ( context ) { return ! ! context . openBehavior && context . openBehavior !== 'AlreadyOpen' && context . openBehavior !== 'DontOpen' ; } }