@@ -27,7 +27,7 @@ export async function promptImportInternetDatabase(
2727 databasesManager : DatabaseManager ,
2828 storagePath : string ,
2929 progress : ProgressCallback ,
30- _ : CancellationToken ,
30+ token : CancellationToken ,
3131) : Promise < DatabaseItem | undefined > {
3232 const databaseUrl = await window . showInputBox ( {
3333 prompt : 'Enter URL of zipfile of database to download' ,
@@ -42,7 +42,8 @@ export async function promptImportInternetDatabase(
4242 databaseUrl ,
4343 databasesManager ,
4444 storagePath ,
45- progress
45+ progress ,
46+ token
4647 ) ;
4748
4849 if ( item ) {
@@ -65,7 +66,7 @@ export async function promptImportLgtmDatabase(
6566 databasesManager : DatabaseManager ,
6667 storagePath : string ,
6768 progress : ProgressCallback ,
68- _ : CancellationToken
69+ token : CancellationToken
6970) : Promise < DatabaseItem | undefined > {
7071 const lgtmUrl = await window . showInputBox ( {
7172 prompt :
@@ -82,7 +83,8 @@ export async function promptImportLgtmDatabase(
8283 databaseUrl ,
8384 databasesManager ,
8485 storagePath ,
85- progress
86+ progress ,
87+ token
8688 ) ;
8789 if ( item ) {
8890 commands . executeCommand ( 'codeQLDatabases.focus' ) ;
@@ -108,14 +110,15 @@ export async function importArchiveDatabase(
108110 databasesManager : DatabaseManager ,
109111 storagePath : string ,
110112 progress : ProgressCallback ,
111- _ : CancellationToken ,
113+ token : CancellationToken ,
112114) : Promise < DatabaseItem | undefined > {
113115 try {
114116 const item = await databaseArchiveFetcher (
115117 databaseUrl ,
116118 databasesManager ,
117119 storagePath ,
118- progress
120+ progress ,
121+ token
119122 ) ;
120123 if ( item ) {
121124 commands . executeCommand ( 'codeQLDatabases.focus' ) ;
@@ -139,15 +142,17 @@ export async function importArchiveDatabase(
139142 * @param databaseUrl URL from which to grab the database
140143 * @param databasesManager the DatabaseManager
141144 * @param storagePath where to store the unzipped database.
142- * @param progressCallback optional callback to send progress messages to
145+ * @param progress callback to send progress messages to
146+ * @param token cancellation token
143147 */
144148async function databaseArchiveFetcher (
145149 databaseUrl : string ,
146150 databasesManager : DatabaseManager ,
147151 storagePath : string ,
148- progressCallback ?: ProgressCallback
152+ progress : ProgressCallback ,
153+ token : CancellationToken
149154) : Promise < DatabaseItem > {
150- progressCallback ?. ( {
155+ progress ( {
151156 message : 'Getting database' ,
152157 step : 1 ,
153158 maxStep : 4 ,
@@ -161,10 +166,10 @@ async function databaseArchiveFetcher(
161166 if ( isFile ( databaseUrl ) ) {
162167 await readAndUnzip ( databaseUrl , unzipPath ) ;
163168 } else {
164- await fetchAndUnzip ( databaseUrl , unzipPath , progressCallback ) ;
169+ await fetchAndUnzip ( databaseUrl , unzipPath , progress ) ;
165170 }
166171
167- progressCallback ?. ( {
172+ progress ( {
168173 message : 'Opening database' ,
169174 step : 3 ,
170175 maxStep : 4 ,
@@ -177,14 +182,14 @@ async function databaseArchiveFetcher(
177182 'codeql-database.yml'
178183 ) ;
179184 if ( dbPath ) {
180- progressCallback ?. ( {
185+ progress ( {
181186 message : 'Validating and fixing source location' ,
182187 step : 4 ,
183188 maxStep : 4 ,
184189 } ) ;
185190 await ensureZippedSourceLocation ( dbPath ) ;
186191
187- const item = await databasesManager . openDatabase ( Uri . file ( dbPath ) ) ;
192+ const item = await databasesManager . openDatabase ( progress , token , Uri . file ( dbPath ) ) ;
188193 databasesManager . setCurrentDatabaseItem ( item ) ;
189194 return item ;
190195 } else {
0 commit comments