Convert codeQL.restartQueryServer to a typed command
This commit is contained in:
@@ -27,6 +27,8 @@ export type SingleSelectionCommandFunction<Item> = (
|
||||
// Base commands not tied directly to a module like e.g. variant analysis.
|
||||
export type BaseCommands = {
|
||||
"codeQL.openDocumentation": () => Promise<void>;
|
||||
|
||||
"codeQL.restartQueryServer": () => Promise<void>;
|
||||
};
|
||||
|
||||
// Commands used for the query history panel
|
||||
|
||||
@@ -169,11 +169,28 @@ const extension = extensions.getExtension(extensionId);
|
||||
/**
|
||||
* Return all commands that are not tied to the more specific managers.
|
||||
*/
|
||||
function getCommands(): BaseCommands {
|
||||
function getCommands(
|
||||
cliServer: CodeQLCliServer,
|
||||
queryRunner: QueryRunner,
|
||||
): BaseCommands {
|
||||
return {
|
||||
"codeQL.openDocumentation": async () => {
|
||||
await env.openExternal(Uri.parse("https://codeql.github.com/docs/"));
|
||||
},
|
||||
"codeQL.restartQueryServer": async () =>
|
||||
withProgress(
|
||||
async (progress: ProgressCallback, token: CancellationToken) => {
|
||||
// We restart the CLI server too, to ensure they are the same version
|
||||
cliServer.restartCliServer();
|
||||
await queryRunner.restartQueryServer(progress, token);
|
||||
void showAndLogInformationMessage("CodeQL Query Server restarted.", {
|
||||
outputLogger: queryServerLogger,
|
||||
});
|
||||
},
|
||||
{
|
||||
title: "Restarting Query Server",
|
||||
},
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1097,7 +1114,7 @@ async function activateWithInstalledDistribution(
|
||||
);
|
||||
|
||||
const allCommands: AllCommands = {
|
||||
...getCommands(),
|
||||
...getCommands(cliServer, qs),
|
||||
...qhm.getCommands(),
|
||||
...variantAnalysisManager.getCommands(),
|
||||
...databaseUI.getCommands(),
|
||||
@@ -1212,24 +1229,6 @@ async function activateWithInstalledDistribution(
|
||||
}),
|
||||
);
|
||||
|
||||
ctx.subscriptions.push(
|
||||
commandRunner("codeQL.restartQueryServer", async () =>
|
||||
withProgress(
|
||||
async (progress: ProgressCallback, token: CancellationToken) => {
|
||||
// We restart the CLI server too, to ensure they are the same version
|
||||
cliServer.restartCliServer();
|
||||
await qs.restartQueryServer(progress, token);
|
||||
void showAndLogInformationMessage("CodeQL Query Server restarted.", {
|
||||
outputLogger: queryServerLogger,
|
||||
});
|
||||
},
|
||||
{
|
||||
title: "Restarting Query Server",
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
ctx.subscriptions.push(
|
||||
commandRunnerWithProgress(
|
||||
"codeQL.chooseDatabaseFolder",
|
||||
|
||||
Reference in New Issue
Block a user