@@ -370,7 +370,7 @@ export async function prompt_install_sdk_picker(
370370
371371 quick_pick . items = [
372372 {
373- label : 'Current ' ,
373+ label : 'Recommended ' ,
374374 kind : vscode . QuickPickItemKind . Separator ,
375375 } ,
376376 ...recommended_sdks . map ( map_sdk ) ,
@@ -384,7 +384,7 @@ export async function prompt_install_sdk_picker(
384384 kind : vscode . QuickPickItemKind . Separator ,
385385 } ,
386386 {
387- label : 'Show all' ,
387+ label : 'Show all versions ' ,
388388 iconPath : new vscode . ThemeIcon ( 'more' ) ,
389389 } ,
390390 ]
@@ -397,20 +397,18 @@ export async function prompt_install_sdk_picker(
397397 }
398398 } )
399399
400- return new Promise < string | void > ( ( resolve , reject ) => {
400+ const promise = new Promise < string | void > ( ( resolve , reject ) => {
401401 quick_pick . onDidAccept ( async ( ) => {
402402 try {
403403 const selection = quick_pick . selectedItems [ 0 ]
404404
405- if ( selection . label === 'Show all' ) {
405+ if ( selection . label === 'Show all versions ' ) {
406406 quick_pick . items = all_valid_sdks . map ( map_sdk )
407407 return
408408 }
409409
410- if ( ! selection || ! selection . url ) {
411- resolve ( undefined )
412- return
413- }
410+ if ( ! selection || ! selection . url )
411+ return reject ( 'invalid selection state' )
414412
415413 quick_pick . hide ( )
416414
@@ -421,15 +419,15 @@ export async function prompt_install_sdk_picker(
421419 context
422420 )
423421
424- if ( ! file ) return resolve ( undefined )
422+ if ( ! file ) return reject ( 'missing file after download' )
425423
426424 await set_config ( 'sdkPath' , file , true )
427425
428426 vscode . window . showInformationMessage (
429427 `Ren'Py ${ selection . label } installed and set as current SDK`
430428 )
431429
432- return prompt_sdk_quick_pick ( context )
430+ return resolve ( undefined )
433431 } catch ( error ) {
434432 logger . error ( 'Error during SDK installation:' , error )
435433 vscode . window . showErrorMessage (
@@ -442,8 +440,13 @@ export async function prompt_install_sdk_picker(
442440 } )
443441
444442 quick_pick . onDidHide ( ( ) => {
445- quick_pick . dispose ( )
446443 resolve ( undefined )
447444 } )
448445 } )
446+
447+ promise . finally ( ( ) => {
448+ quick_pick . dispose ( )
449+ } )
450+
451+ return promise
449452}
0 commit comments