Convert extensions/ql-vscode/src/query-server/queryserver-client.ts to call typed commands
This commit is contained in:
@@ -1074,6 +1074,7 @@ async function createQueryServer(
|
||||
);
|
||||
if (await cliServer.cliConstraints.supportsNewQueryServer()) {
|
||||
const qs = new QueryServerClient(
|
||||
app,
|
||||
qlConfigurationListener,
|
||||
cliServer,
|
||||
qsOpts,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ensureFile } from "fs-extra";
|
||||
|
||||
import { DisposableObject } from "../pure/disposable-object";
|
||||
import { CancellationToken, commands } from "vscode";
|
||||
import { CancellationToken } from "vscode";
|
||||
import { createMessageConnection, RequestType } from "vscode-jsonrpc/node";
|
||||
import * as cli from "../cli";
|
||||
import { QueryServerConfig } from "../config";
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
} from "../pure/new-messages";
|
||||
import { ProgressCallback, ProgressTask } from "../progress";
|
||||
import { ServerProcess } from "../json-rpc-server";
|
||||
import { App } from "../common/app";
|
||||
|
||||
type ServerOpts = {
|
||||
logger: Logger;
|
||||
@@ -53,6 +54,7 @@ export class QueryServerClient extends DisposableObject {
|
||||
public activeQueryLogger: Logger;
|
||||
|
||||
constructor(
|
||||
app: App,
|
||||
readonly config: QueryServerConfig,
|
||||
readonly cliServer: cli.CodeQLCliServer,
|
||||
readonly opts: ServerOpts,
|
||||
@@ -66,7 +68,7 @@ export class QueryServerClient extends DisposableObject {
|
||||
if (config.onDidChangeConfiguration !== undefined) {
|
||||
this.push(
|
||||
config.onDidChangeConfiguration(() =>
|
||||
commands.executeCommand("codeQL.restartQueryServer"),
|
||||
app.commands.execute("codeQL.restartQueryServer"),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { extLogger, ProgressReporter } from "../../../src/common";
|
||||
import { QueryResultType } from "../../../src/pure/new-messages";
|
||||
import { cleanDatabases, dbLoc, storagePath } from "../global.helper";
|
||||
import { importArchiveDatabase } from "../../../src/databaseFetcher";
|
||||
import { createMockCommandManager } from "../../__mocks__/commandsMock";
|
||||
import { createMockApp } from "../../__mocks__/appMock";
|
||||
|
||||
const baseDir = join(__dirname, "../../../test/data");
|
||||
|
||||
@@ -110,6 +110,7 @@ describeWithCodeQL()("using the new query server", () => {
|
||||
let supportNewQueryServer = true;
|
||||
|
||||
beforeAll(async () => {
|
||||
const app = createMockApp({});
|
||||
const extension = await extensions
|
||||
.getExtension<CodeQLExtensionInterface | Record<string, never>>(
|
||||
"GitHub.vscode-codeql",
|
||||
@@ -123,6 +124,7 @@ describeWithCodeQL()("using the new query server", () => {
|
||||
supportNewQueryServer = false;
|
||||
}
|
||||
qs = new QueryServerClient(
|
||||
app,
|
||||
{
|
||||
codeQlPath:
|
||||
(await extension.distributionManager.getCodeQlPathWithoutVersionCheck()) ||
|
||||
@@ -148,7 +150,7 @@ describeWithCodeQL()("using the new query server", () => {
|
||||
await cleanDatabases(extension.databaseManager);
|
||||
const uri = Uri.file(dbLoc);
|
||||
const maybeDbItem = await importArchiveDatabase(
|
||||
createMockCommandManager(),
|
||||
app.commands,
|
||||
uri.toString(true),
|
||||
extension.databaseManager,
|
||||
storagePath,
|
||||
|
||||
Reference in New Issue
Block a user