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