@@ -131,14 +131,57 @@ export async function pickCreator(creators: PythonProjectCreator[]): Promise<Pyt
131131 return creators [ 0 ] ;
132132 }
133133
134- const items : ( QuickPickItem & { c : PythonProjectCreator } ) [ ] = creators . map ( ( c ) => ( {
135- label : c . displayName ?? c . name ,
136- description : c . description ,
137- c : c ,
138- } ) ) ;
134+ // First level menu
135+ const autoFindCreator = creators . find ( ( c ) => c . name === 'autoProjects' ) ;
136+ const existingProjectsCreator = creators . find ( ( c ) => c . name === 'existingProjects' ) ;
137+ const otherCreators = creators . filter ( ( c ) => c . name !== 'autoProjects' && c . name !== 'existingProjects' ) ;
138+
139+ const items : QuickPickItem [ ] = [
140+ {
141+ label : 'Auto Find' ,
142+ description : autoFindCreator ?. description ?? 'Automatically find Python projects' ,
143+ } ,
144+ {
145+ label : 'Select Existing' ,
146+ description : existingProjectsCreator ?. description ?? 'Select existing Python projects' ,
147+ } ,
148+ {
149+ label : 'Create New...' ,
150+ description : 'Create a new Python project from a template' ,
151+ } ,
152+ ] ;
153+
139154 const selected = await showQuickPick ( items , {
140155 placeHolder : Pickers . Managers . selectProjectCreator ,
141156 ignoreFocusOut : true ,
142157 } ) ;
143- return ( selected as { c : PythonProjectCreator } ) ?. c ;
158+
159+ if ( ! selected ) {
160+ return undefined ;
161+ }
162+
163+ // Return appropriate creator based on selection
164+ switch ( selected . label ) {
165+ case 'Auto Find' :
166+ return autoFindCreator ;
167+ case 'Select Existing' :
168+ return existingProjectsCreator ;
169+ case 'Create New...' :
170+ // Show second level menu for other creators
171+ if ( otherCreators . length === 0 ) {
172+ return undefined ;
173+ }
174+ const newItems : ( QuickPickItem & { c : PythonProjectCreator } ) [ ] = otherCreators . map ( ( c ) => ( {
175+ label : c . displayName ?? c . name ,
176+ description : c . description ,
177+ c : c ,
178+ } ) ) ;
179+ const newSelected = await showQuickPick ( newItems , {
180+ placeHolder : 'Select project type for new project' ,
181+ ignoreFocusOut : true ,
182+ } ) ;
183+ return newSelected ?. c ;
184+ }
185+
186+ return undefined ;
144187}
0 commit comments