33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { AzureWizardPromptStep , type AzureWizardExecuteStep , type IAzureQuickPickItem , type IWizardOptions } from '@microsoft/vscode-azext-utils' ;
7- import { type QuickPickOptions } from 'vscode' ;
6+ import { AzureWizardPromptStep , UserCancelledError , type AzureWizardExecuteStep , type IAzureQuickPickItem , type IWizardOptions } from '@microsoft/vscode-azext-utils' ;
7+ import { QuickPickItemKind , type QuickPickOptions } from 'vscode' ;
88import { ProjectLanguage , nodeDefaultModelVersion , nodeLearnMoreLink , nodeModels , pythonDefaultModelVersion , pythonLearnMoreLink , pythonModels , showBallerinaProjectCreationSetting } from '../../constants' ;
9+ import { ext } from '../../extensionVariables' ;
910import { localize } from '../../localize' ;
1011import { TemplateSchemaVersion } from '../../templates/TemplateProviderBase' ;
1112import { nonNullProp } from '../../utils/nonNull' ;
1213import { getWorkspaceSetting } from '../../vsCodeConfig/settings' ;
14+ import { FunctionListStep } from '../createFunction/FunctionListStep' ;
1315import { addInitVSCodeSteps } from '../initProjectForVSCode/InitVSCodeLanguageStep' ;
1416import { type IProjectWizardContext } from './IProjectWizardContext' ;
1517import { ProgrammingModelStep } from './ProgrammingModelStep' ;
@@ -20,14 +22,17 @@ import { PowerShellProjectCreateStep } from './ProjectCreateStep/PowerShellProje
2022import { PythonProjectCreateStep } from './ProjectCreateStep/PythonProjectCreateStep' ;
2123import { ScriptProjectCreateStep } from './ProjectCreateStep/ScriptProjectCreateStep' ;
2224import { TypeScriptProjectCreateStep } from './ProjectCreateStep/TypeScriptProjectCreateStep' ;
23- import { StartingPointStep } from './StartingPointStep' ;
2425import { addBallerinaCreateProjectSteps } from './ballerinaSteps/addBallerinaCreateProjectSteps' ;
2526import { DotnetRuntimeStep } from './dotnetSteps/DotnetRuntimeStep' ;
2627import { addJavaCreateProjectSteps } from './javaSteps/addJavaCreateProjectSteps' ;
2728import { MCPDownloadSnippetsExecuteStep } from './mcpServerSteps/MCPDownloadSnippetsExecuteStep' ;
2829import { MCPDownloadSnippetsPromptStep } from './mcpServerSteps/MCPDownloadSnippetsPromptStep' ;
2930import { MCPProjectCreateStep } from './mcpServerSteps/MCPProjectCreateStep' ;
3031import { MCPServerLanguagePromptStep } from './mcpServerSteps/MCPServerLanguagePromptStep' ;
32+ import { TemplateGalleryPanel } from './TemplateGalleryPanel' ;
33+
34+ // Sentinel value used to detect when the user picks "Browse Template Gallery…"
35+ const templateGalleryLanguage = 'TemplateGallery' as ProjectLanguage ;
3136
3237export class NewProjectLanguageStep extends AzureWizardPromptStep < IProjectWizardContext > {
3338 public hideStepCount : boolean = true ;
@@ -64,8 +69,25 @@ export class NewProjectLanguageStep extends AzureWizardPromptStep<IProjectWizard
6469 } ) ;
6570 }
6671
72+ // Add a separator and a "Browse Template Gallery…" option at the bottom
73+ languagePicks . push (
74+ { label : '' , data : { language : templateGalleryLanguage } , kind : QuickPickItemKind . Separator } ,
75+ {
76+ label : `$(library) ${ localize ( 'browseTemplateGallery' , 'Browse Template Gallery...' ) } ` ,
77+ data : { language : templateGalleryLanguage } ,
78+ suppressPersistence : true ,
79+ } ,
80+ ) ;
81+
6782 const options : QuickPickOptions = { placeHolder : localize ( 'selectProjectType' , 'Select a project type' ) } ;
6883 const result = ( await context . ui . showQuickPick ( languagePicks , options ) ) . data ;
84+
85+ if ( result . language === templateGalleryLanguage ) {
86+ TemplateGalleryPanel . createOrShow ( ext . context . extensionUri ) ;
87+ context . telemetry . properties . flow = 'templateGalleryFromWizard' ;
88+ throw new UserCancelledError ( 'templateGallery' ) ;
89+ }
90+
6991 context . language = result . language ;
7092 this . setTemplateSchemaVersion ( context ) ;
7193 }
@@ -138,11 +160,13 @@ export class NewProjectLanguageStep extends AzureWizardPromptStep<IProjectWizard
138160
139161 const wizardOptions : IWizardOptions < IProjectWizardContext > = { promptSteps, executeSteps } ;
140162
141- // Add StartingPointStep which handles both template and scratch paths
142- // For template path: shows template selection and clones project
143- // For scratch path: shows existing function trigger selection (FunctionListStep)
144- // Note: Java needs to fix this issue first: https://github.com/Microsoft/vscode-azurefunctions/issues/81
145- promptSteps . push ( new StartingPointStep ( this . _templateId , this . _functionSettings ) ) ;
163+ // All languages except Java support creating a function after creating a project
164+ // Java needs to fix this issue first: https://github.com/Microsoft/vscode-azurefunctions/issues/81
165+ promptSteps . push ( new FunctionListStep ( {
166+ isProjectWizard : true ,
167+ templateId : this . _templateId ,
168+ functionSettings : this . _functionSettings ,
169+ } ) ) ;
146170
147171 return wizardOptions ;
148172 }
0 commit comments