Skip to content

Commit d7e061e

Browse files
Convert extensions/ql-vscode/src/databases/ui/db-panel.ts to use typed commands
1 parent 2a2cb26 commit d7e061e

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

extensions/ql-vscode/src/common/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export type BuiltInVsCodeCommands = {
4848
title?: string,
4949
columnOrOptions?: TextDocumentShowOptions,
5050
) => Promise<void>;
51+
"vscode.open": (uri: Uri) => Promise<void>;
5152
"vscode.openFolder": (uri: Uri) => Promise<void>;
5253
};
5354

extensions/ql-vscode/src/databases/db-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class DbModule extends DisposableObject {
4343

4444
await this.dbConfigStore.initialize();
4545

46-
this.dbPanel = new DbPanel(this.dbManager, app.credentials);
46+
this.dbPanel = new DbPanel(app, this.dbManager);
4747

4848
this.push(this.dbPanel);
4949
this.push(this.dbConfigStore);

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
commands,
32
QuickPickItem,
43
TreeView,
54
TreeViewExpansionEvent,
@@ -31,8 +30,8 @@ import { DbTreeViewItem } from "./db-tree-view-item";
3130
import { getGitHubUrl } from "./db-tree-view-item-action";
3231
import { getControllerRepo } from "../../variant-analysis/run-remote-query";
3332
import { getErrorMessage } from "../../pure/helpers-pure";
34-
import { Credentials } from "../../common/authentication";
3533
import { DatabasePanelCommands } from "../../common/commands";
34+
import { App } from "../../common/app";
3635

3736
export interface RemoteDatabaseQuickPickItem extends QuickPickItem {
3837
kind: string;
@@ -47,8 +46,8 @@ export class DbPanel extends DisposableObject {
4746
private readonly treeView: TreeView<DbTreeViewItem>;
4847

4948
public constructor(
49+
private readonly app: App,
5050
private readonly dbManager: DbManager,
51-
private readonly credentials: Credentials,
5251
) {
5352
super();
5453

@@ -369,13 +368,13 @@ export class DbPanel extends DisposableObject {
369368
);
370369
}
371370

372-
await commands.executeCommand("vscode.open", Uri.parse(githubUrl));
371+
await this.app.commands.execute("vscode.open", Uri.parse(githubUrl));
373372
}
374373

375374
private async setupControllerRepository(): Promise<void> {
376375
try {
377376
// This will also validate that the controller repository is valid
378-
await getControllerRepo(this.credentials);
377+
await getControllerRepo(this.app.credentials);
379378
} catch (e: unknown) {
380379
if (e instanceof UserCancellationException) {
381380
return;

0 commit comments

Comments
 (0)