Convert extensions/ql-vscode/src/local-databases.ts to call typed commands
This commit is contained in:
@@ -678,7 +678,7 @@ async function activateWithInstalledDistribution(
|
||||
}
|
||||
|
||||
void extLogger.log("Initializing database manager.");
|
||||
const dbm = new DatabaseManager(ctx, qs, cliServer, extLogger);
|
||||
const dbm = new DatabaseManager(ctx, app, qs, cliServer, extLogger);
|
||||
|
||||
// Let this run async.
|
||||
void dbm.loadPersistedState();
|
||||
|
||||
@@ -28,6 +28,7 @@ import { redactableError } from "./pure/errors";
|
||||
import { isCodespacesTemplate } from "./config";
|
||||
import { QlPackGenerator } from "./qlpack-generator";
|
||||
import { QueryLanguage } from "./common/query-language";
|
||||
import { App } from "./common/app";
|
||||
|
||||
/**
|
||||
* databases.ts
|
||||
@@ -593,6 +594,7 @@ export class DatabaseManager extends DisposableObject {
|
||||
|
||||
constructor(
|
||||
private readonly ctx: ExtensionContext,
|
||||
private readonly app: App,
|
||||
private readonly qs: QueryRunner,
|
||||
private readonly cli: cli.CodeQLCliServer,
|
||||
public logger: Logger,
|
||||
@@ -875,7 +877,7 @@ export class DatabaseManager extends DisposableObject {
|
||||
this._currentDatabaseItem = item;
|
||||
this.updatePersistedCurrentDatabaseItem();
|
||||
|
||||
await vscode.commands.executeCommand(
|
||||
await this.app.commands.execute(
|
||||
"setContext",
|
||||
"codeQL.currentDatabaseItem",
|
||||
item?.name,
|
||||
|
||||
@@ -25,6 +25,7 @@ import * as helpers from "../../../src/helpers";
|
||||
import { Setting } from "../../../src/config";
|
||||
import { QlPackGenerator } from "../../../src/qlpack-generator";
|
||||
import { mockedObject } from "../utils/mocking.helpers";
|
||||
import { createMockApp } from "../../__mocks__/appMock";
|
||||
|
||||
describe("local databases", () => {
|
||||
const MOCK_DB_OPTIONS: FullDatabaseOptions = {
|
||||
@@ -87,6 +88,7 @@ describe("local databases", () => {
|
||||
|
||||
databaseManager = new DatabaseManager(
|
||||
extensionContext,
|
||||
createMockApp({}),
|
||||
mockedObject<QueryRunner>({
|
||||
registerDatabase: registerSpy,
|
||||
deregisterDatabase: deregisterSpy,
|
||||
|
||||
Reference in New Issue
Block a user