@@ -51,6 +51,7 @@ interface LibraryQuickPickItem extends QuickPickItem {
5151}
5252
5353const COMPILER_CORE_TEMPLATES = "compiler-core-templates" ;
54+ const TITLE = "Create a TypeSpec project" ;
5455export async function createTypeSpecProject ( client : TspLanguageClient | undefined ) {
5556 await vscode . window . withProgress (
5657 {
@@ -153,7 +154,7 @@ export async function createTypeSpecProject(client: TspLanguageClient | undefine
153154 }
154155
155156 const includeGitignoreResult = await vscode . window . showQuickPick ( [ "Yes" , "No" ] , {
156- title : "Do you want to generate a .gitignore file" ,
157+ title : TITLE ,
157158 canPickMany : false ,
158159 placeHolder : "Do you want to generate a .gitignore file" ,
159160 ignoreFocusOut : true ,
@@ -332,7 +333,7 @@ async function validateTemplate(
332333 `Current tsp version (${ compilerVersion } ) < template designed tsp version(${ templateRequiredVersion } ). ` +
333334 `The project created may not be correct. Do you want to continue?` ,
334335 ignoreFocusOut : true ,
335- title : "Template version mismatches with tsp. Do you want to continue?" ,
336+ title : TITLE ,
336337 } ) ;
337338 if ( cont !== "Yes" ) {
338339 logger . info (
@@ -353,7 +354,7 @@ async function validateTemplate(
353354 placeHolder :
354355 "Template validation failed. Do you want to continue? Detail log can be found in the Output window." ,
355356 ignoreFocusOut : true ,
356- title : "Template validation failed. Do you want to continue?" ,
357+ title : TITLE ,
357358 } ) ;
358359 if ( cont !== "Yes" ) {
359360 logger . info ( "Creating TypeSpec Project cancelled due to template validation failure." ) ;
@@ -420,9 +421,9 @@ async function selectLibraries(
420421 } ) ?? [ ] ;
421422 if ( libs . length === 0 ) return [ ] ;
422423 const librariesToUpgrade = await vscode . window . showQuickPick < LibraryQuickPickItem > ( libs , {
423- title : "Please select libraries to include" ,
424+ title : TITLE ,
424425 canPickMany : true ,
425- placeHolder : "Please select libraries to include " ,
426+ placeHolder : "Here are libraries to install. " ,
426427 ignoreFocusOut : true ,
427428 } ) ;
428429 return librariesToUpgrade ?. map ( ( x ) => ( { name : x . name , version : x . version } ) ) ;
@@ -488,7 +489,7 @@ async function selectTemplate(
488489 quickPickup . items = templatePickupItems ;
489490 quickPickup . canSelectMany = false ;
490491 quickPickup . ignoreFocusOut = true ;
491- quickPickup . title = "Please select a template" ;
492+ quickPickup . title = TITLE ;
492493 quickPickup . placeholder = "Please select a template" ;
493494 const gotoConfigSettings = ( ) => {
494495 logger . info ( "User select to open settings to configure TypeSpec Project Templates" ) ;
@@ -634,10 +635,10 @@ async function selectProjectRootFolder(): Promise<string | undefined> {
634635 logger . info ( "Select Project Folder as Root" ) ;
635636 const folderOptions : OpenDialogOptions = {
636637 canSelectMany : false ,
637- openLabel : "Select Folder" ,
638+ openLabel : "Select Project Folder as Root " ,
638639 canSelectFolders : true ,
639640 canSelectFiles : false ,
640- title : "Select project root folder " ,
641+ title : "Select Folder " ,
641642 } ;
642643
643644 const folderUri = await vscode . window . showOpenDialog ( folderOptions ) ;
@@ -653,13 +654,23 @@ async function checkProjectRootFolderEmpty(selectedFolder: string): Promise<bool
653654 try {
654655 const files = await readdir ( selectedFolder ) ;
655656 if ( files . length > 0 ) {
656- const cont = await vscode . window . showQuickPick ( [ "Yes" , "No" ] , {
657- canPickMany : false ,
658- placeHolder : "The folder to create project is not empty. Do you want to continue?" ,
659- ignoreFocusOut : true ,
660- title : "The folder to create project is not empty. Do you want to continue?" ,
661- } ) ;
662- if ( cont !== "Yes" ) {
657+ const cont = await vscode . window . showQuickPick (
658+ [
659+ {
660+ label : "Yes" ,
661+ detail : `Selected Folder: ${ selectedFolder } ` ,
662+ } ,
663+ { label : "No" } ,
664+ ] ,
665+ {
666+ canPickMany : false ,
667+ placeHolder :
668+ "The folder selected is not empty. Are you sure you want to initialize a new project here?" ,
669+ ignoreFocusOut : true ,
670+ title : TITLE ,
671+ } ,
672+ ) ;
673+ if ( cont ?. label !== "Yes" ) {
663674 logger . info ( "Selected folder is not empty and user confirmed not to continue." ) ;
664675 return false ;
665676 }
@@ -686,9 +697,8 @@ async function CheckCompilerAndStartLSPClient(folder: string): Promise<Result<Ts
686697 if ( ! r . value ) {
687698 const igcArgs : InstallGlobalCliCommandArgs = {
688699 confirm : true ,
689- confirmTitle : "No TypeSpec Compiler/CLI found which is needed to create TypeSpec project." ,
690- confirmPlaceholder :
691- "No TypeSpec Compiler/CLI found which is needed to create TypeSpec project." ,
700+ confirmTitle : TITLE ,
701+ confirmPlaceholder : "Install TypeSpec Compiler CLI." ,
692702 silentMode : true ,
693703 } ;
694704 const result = await vscode . commands . executeCommand < Result < void > > (
0 commit comments