@@ -1052,7 +1052,7 @@ export class LifecycleCommands implements IDisposable {
10521052 } ) ;
10531053
10541054 const connectorQueryFiles : vscode . Uri [ ] = await vscode . workspace . findFiles (
1055- "**/*.query.pq" ,
1055+ "**/*.{ query,test} .pq" ,
10561056 "**/{bin,obj}/**" ,
10571057 1e2 ,
10581058 ) ;
@@ -1075,6 +1075,10 @@ export class LifecycleCommands implements IDisposable {
10751075 label : one ,
10761076 } ) ) ;
10771077
1078+ items . push ( {
1079+ label : extensionI18n [ "PQSdk.lifecycle.command.choose.customizedDataSourceKind.label" ] ,
1080+ } ) ;
1081+
10781082 const picked : vscode . QuickPickItem = await input . showQuickPick ( {
10791083 title,
10801084 step : 1 ,
@@ -1085,9 +1089,17 @@ export class LifecycleCommands implements IDisposable {
10851089 } ) ;
10861090
10871091 state . DataSourceKind = picked . label ;
1088- } else {
1089- // we did not get a list of data source candidates,
1090- // thus have to allow users inputting freely
1092+ }
1093+
1094+ if (
1095+ ! state . DataSourceKind ||
1096+ state . DataSourceKind ===
1097+ extensionI18n [ "PQSdk.lifecycle.command.choose.customizedDataSourceKind.label" ]
1098+ ) {
1099+ // we did not have the DataSourceKind populated,
1100+ // or it was set to customized dataSourceKind label
1101+ // then we should allow users to input arbitrarily
1102+ // eslint-disable-next-line require-atomic-updates
10911103 state . DataSourceKind = await input . showInputBox ( {
10921104 title,
10931105 step : 1 ,
@@ -1114,22 +1126,75 @@ export class LifecycleCommands implements IDisposable {
11141126 input : MultiStepInput ,
11151127 state : Partial < CreateAuthState > ,
11161128 ) : Promise < InputStep | void > {
1117- const items : vscode . QuickPickItem [ ] = connectorQueryFiles . map ( ( one : vscode . Uri ) => ( {
1118- label : vscode . workspace . asRelativePath ( one ) ,
1119- detail : one . fsPath ,
1120- } ) ) ;
1129+ if ( connectorQueryFiles . length ) {
1130+ const items : vscode . QuickPickItem [ ] = connectorQueryFiles . map ( ( one : vscode . Uri ) => ( {
1131+ label : vscode . workspace . asRelativePath ( one ) ,
1132+ detail : one . fsPath ,
1133+ } ) ) ;
11211134
1122- const picked : vscode . QuickPickItem = await input . showQuickPick ( {
1123- title,
1124- step : 2 ,
1125- totalSteps : 3 ,
1126- placeholder : extensionI18n [ "PQSdk.lifecycle.command.choose.connectorFile" ] ,
1127- activeItem : items [ 0 ] ,
1128- items,
1129- } ) ;
1135+ items . push ( {
1136+ label : extensionI18n [ "PQSdk.lifecycle.command.choose.customizedQueryFilePath.label" ] ,
1137+ detail : extensionI18n [ "PQSdk.lifecycle.command.choose.customizedQueryFilePath.detail" ] ,
1138+ } ) ;
11301139
1131- // eslint-disable-next-line require-atomic-updates
1132- state . PathToQueryFile = picked . detail ;
1140+ const picked : vscode . QuickPickItem = await input . showQuickPick ( {
1141+ title,
1142+ step : 2 ,
1143+ totalSteps : 3 ,
1144+ placeholder : extensionI18n [ "PQSdk.lifecycle.command.choose.queryFile" ] ,
1145+ activeItem : items [ 0 ] ,
1146+ items,
1147+ } ) ;
1148+
1149+ // eslint-disable-next-line require-atomic-updates
1150+ state . PathToQueryFile = picked . detail ;
1151+ }
1152+
1153+ if (
1154+ ! state . PathToQueryFile ||
1155+ state . PathToQueryFile ===
1156+ extensionI18n [ "PQSdk.lifecycle.command.choose.customizedQueryFilePath.detail" ]
1157+ ) {
1158+ // we did not have the PathToQueryFile populated,
1159+ // or it was set to customized PathToQueryFile detail
1160+ // then we should allow users to input arbitrarily
1161+ // eslint-disable-next-line require-atomic-updates
1162+ state . PathToQueryFile = await input . showInputBox ( {
1163+ title,
1164+ step : 2 ,
1165+ totalSteps : 3 ,
1166+ value : "" ,
1167+ prompt : extensionI18n [ "PQSdk.lifecycle.command.choose.queryFilePath.label" ] ,
1168+ ignoreFocusOut : true ,
1169+ validate : ( key : string ) =>
1170+ Promise . resolve (
1171+ key . length
1172+ ? undefined
1173+ : extensionI18n [ "PQSdk.lifecycle.error.empty.PathToQueryFilePath" ] ,
1174+ ) ,
1175+ } ) ;
1176+
1177+ // we also need to populate the state.PathToConnectorFile
1178+ // since the PathToQueryFilePath might be another query file
1179+ state . PathToConnectorFile = path . dirname ( state . PathToQueryFile ) ;
1180+
1181+ // need to populate the PathToConnectorFile to re-verify
1182+ // eslint-disable-next-line require-atomic-updates
1183+ state . PathToConnectorFile = await input . showInputBox ( {
1184+ title,
1185+ step : 2 ,
1186+ totalSteps : 3 ,
1187+ value : state . PathToConnectorFile ,
1188+ prompt : extensionI18n [ "PQSdk.lifecycle.command.choose.extensionFilePath.label" ] ,
1189+ ignoreFocusOut : true ,
1190+ validate : ( key : string ) =>
1191+ Promise . resolve (
1192+ key . length
1193+ ? undefined
1194+ : extensionI18n [ "PQSdk.lifecycle.error.empty.PathToConnectorFile" ] ,
1195+ ) ,
1196+ } ) ;
1197+ }
11331198
11341199 progress . report ( { increment : 10 } ) ;
11351200
0 commit comments