11import fetch , { Response } from "node-fetch" ;
22import { zip } from "zip-a-folder" ;
33import { Open } from "unzipper" ;
4- import { Uri , CancellationToken , commands , window } from "vscode" ;
4+ import { Uri , CancellationToken , window } from "vscode" ;
55import { CodeQLCliServer } from "./cli" ;
66import {
77 ensureDir ,
@@ -26,6 +26,7 @@ import {
2626 isValidGitHubNwo ,
2727} from "./common/github-url-identifier-helper" ;
2828import { Credentials } from "./common/authentication" ;
29+ import { AppCommandManager } from "./common/commands" ;
2930
3031/**
3132 * Prompts a user to fetch a database from a remote location. Database is assumed to be an archive file.
@@ -34,6 +35,7 @@ import { Credentials } from "./common/authentication";
3435 * @param storagePath where to store the unzipped database.
3536 */
3637export async function promptImportInternetDatabase (
38+ commandManager : AppCommandManager ,
3739 databaseManager : DatabaseManager ,
3840 storagePath : string ,
3941 progress : ProgressCallback ,
@@ -61,7 +63,7 @@ export async function promptImportInternetDatabase(
6163 ) ;
6264
6365 if ( item ) {
64- await commands . executeCommand ( "codeQLDatabases.focus" ) ;
66+ await commandManager . execute ( "codeQLDatabases.focus" ) ;
6567 void showAndLogInformationMessage (
6668 "Database downloaded and imported successfully." ,
6769 ) ;
@@ -78,6 +80,7 @@ export async function promptImportInternetDatabase(
7880 * @param storagePath where to store the unzipped database.
7981 */
8082export async function promptImportGithubDatabase (
83+ commandManager : AppCommandManager ,
8184 databaseManager : DatabaseManager ,
8285 storagePath : string ,
8386 credentials : Credentials | undefined ,
@@ -141,7 +144,7 @@ export async function promptImportGithubDatabase(
141144 cli ,
142145 ) ;
143146 if ( item ) {
144- await commands . executeCommand ( "codeQLDatabases.focus" ) ;
147+ await commandManager . execute ( "codeQLDatabases.focus" ) ;
145148 void showAndLogInformationMessage (
146149 "Database downloaded and imported successfully." ,
147150 ) ;
@@ -158,6 +161,7 @@ export async function promptImportGithubDatabase(
158161 * @param storagePath where to store the unzipped database.
159162 */
160163export async function importArchiveDatabase (
164+ commandManager : AppCommandManager ,
161165 databaseUrl : string ,
162166 databaseManager : DatabaseManager ,
163167 storagePath : string ,
@@ -177,7 +181,7 @@ export async function importArchiveDatabase(
177181 cli ,
178182 ) ;
179183 if ( item ) {
180- await commands . executeCommand ( "codeQLDatabases.focus" ) ;
184+ await commandManager . execute ( "codeQLDatabases.focus" ) ;
181185 void showAndLogInformationMessage (
182186 "Database unzipped and imported successfully." ,
183187 ) ;
0 commit comments