Move codeQL.chooseDatabaseFolder command

This commit is contained in:
Koen Vlaswinkel
2023-03-21 14:44:46 +01:00
parent ac2f4475c0
commit 32b6ad53cf
3 changed files with 14 additions and 10 deletions

View File

@@ -64,6 +64,7 @@ export type QueryHistoryCommands = {
// Commands used for the local databases panel
export type LocalDatabasesCommands = {
// Command palette commands
"codeQL.chooseDatabaseFolder": () => Promise<void>;
"codeQL.upgradeCurrentDatabase": () => Promise<void>;
"codeQL.clearCache": () => Promise<void>;

View File

@@ -1220,16 +1220,6 @@ async function activateWithInstalledDistribution(
),
);
ctx.subscriptions.push(
commandRunnerWithProgress(
"codeQL.chooseDatabaseFolder",
(progress: ProgressCallback, token: CancellationToken) =>
databaseUI.chooseDatabaseFolder(progress, token),
{
title: "Choose a Database from a Folder",
},
),
);
ctx.subscriptions.push(
commandRunnerWithProgress(
"codeQL.chooseDatabaseArchive",

View File

@@ -208,6 +208,8 @@ export class DatabaseUI extends DisposableObject {
public getCommands(): LocalDatabasesCommands {
return {
"codeQL.chooseDatabaseFolder":
this.handleChooseDatabaseFolderFromPalette.bind(this),
"codeQL.setCurrentDatabase": this.handleSetCurrentDatabase.bind(this),
"codeQL.setDefaultTourDatabase":
this.handleSetDefaultTourDatabase.bind(this),
@@ -268,6 +270,17 @@ export class DatabaseUI extends DisposableObject {
);
}
private async handleChooseDatabaseFolderFromPalette(): Promise<void> {
return withProgress(
async (progress, token) => {
await this.chooseDatabaseFolder(progress, token);
},
{
title: "Choose a Database from a Folder",
},
);
}
private async handleSetDefaultTourDatabase(): Promise<void> {
return withProgress(
async (progress, token) => {