Skip to content

Commit c017728

Browse files
committed
Add all db-getting commands (dl, folder, zip) to command palette
1 parent ab09cdb commit c017728

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

extensions/ql-vscode/package.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
"onCommand:codeQLDatabases.chooseDatabaseArchive",
3232
"onCommand:codeQLDatabases.chooseDatabaseInternet",
3333
"onCommand:codeQL.setCurrentDatabase",
34-
"onCommand:codeQL.downloadDatabase",
34+
"onCommand:codeQL.chooseDatabaseFolder",
35+
"onCommand:codeQL.chooseDatabaseArchive",
36+
"onCommand:codeQL.chooseDatabaseInternet",
3537
"onCommand:codeQLDatabases.chooseDatabase",
3638
"onCommand:codeQLDatabases.setCurrentDatabase",
3739
"onCommand:codeQL.quickQuery",
@@ -231,7 +233,15 @@
231233
"title": "Show Database Directory"
232234
},
233235
{
234-
"command": "codeQL.downloadDatabase",
236+
"command": "codeQL.chooseDatabaseFolder",
237+
"title": "CodeQL: Choose Database from Folder"
238+
},
239+
{
240+
"command": "codeQL.chooseDatabaseArchive",
241+
"title": "CodeQL: Choose Database from Archive"
242+
},
243+
{
244+
"command": "codeQL.chooseDatabaseInternet",
235245
"title": "CodeQL: Download Database"
236246
},
237247
{
@@ -406,10 +416,6 @@
406416
"command": "codeQL.runQuery",
407417
"when": "resourceLangId == ql && resourceExtname == .ql"
408418
},
409-
{
410-
"command": "codeQL.downloadDatabase",
411-
"when": "true"
412-
},
413419
{
414420
"command": "codeQL.quickEval",
415421
"when": "editorLangId == ql"

extensions/ql-vscode/src/databases-ui.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class DatabaseUI extends DisposableObject {
193193
await this.databaseManager.setCurrentDatabaseItem(databaseItem);
194194
}
195195

196-
private handleChooseDatabaseFolder = async (): Promise<DatabaseItem | undefined> => {
196+
handleChooseDatabaseFolder = async (): Promise<DatabaseItem | undefined> => {
197197
try {
198198
return await this.chooseAndSetDatabase(true);
199199
} catch (e) {
@@ -202,7 +202,7 @@ export class DatabaseUI extends DisposableObject {
202202
}
203203
}
204204

205-
private handleChooseDatabaseArchive = async (): Promise<DatabaseItem | undefined> => {
205+
handleChooseDatabaseArchive = async (): Promise<DatabaseItem | undefined> => {
206206
try {
207207
return await this.chooseAndSetDatabase(false);
208208
} catch (e) {
@@ -211,7 +211,7 @@ export class DatabaseUI extends DisposableObject {
211211
}
212212
}
213213

214-
private handleChooseDatabaseInternet = async (): Promise<DatabaseItem | undefined> => {
214+
handleChooseDatabaseInternet = async (): Promise<DatabaseItem | undefined> => {
215215
return await promptImportInternetDatabase(this.databaseManager, this.storagePath);
216216
}
217217

extensions/ql-vscode/src/extension.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { displayQuickQuery } from './quick-query';
2020
import { compileAndRunQueryAgainstDatabase, tmpDirDisposal, UserCancellationException } from './run-queries';
2121
import { QLTestAdapterFactory } from './test-adapter';
2222
import { TestUIService } from './test-ui';
23-
import { promptImportInternetDatabase } from './databaseFetcher';
2423

2524
/**
2625
* extension.ts
@@ -335,7 +334,9 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
335334
await qs.restartQueryServer();
336335
helpers.showAndLogInformationMessage('CodeQL Query Server restarted.', { outputLogger: queryServerLogger });
337336
}));
338-
ctx.subscriptions.push(commands.registerCommand('codeQL.downloadDatabase', () => promptImportInternetDatabase(dbm, getContextStoragePath(ctx))));
337+
ctx.subscriptions.push(commands.registerCommand('codeQL.chooseDatabaseFolder', () => databaseUI.handleChooseDatabaseFolder()));
338+
ctx.subscriptions.push(commands.registerCommand('codeQL.chooseDatabaseArchive', () => databaseUI.handleChooseDatabaseArchive()));
339+
ctx.subscriptions.push(commands.registerCommand('codeQL.chooseDatabaseInternet', () => databaseUI.handleChooseDatabaseInternet()));
339340

340341
ctx.subscriptions.push(client.start());
341342

0 commit comments

Comments
 (0)