Split up codeQL.restartQueryServer command

This commit is contained in:
Robert
2023-04-05 13:35:40 +01:00
parent 9015a57732
commit 145764c39b
4 changed files with 25 additions and 19 deletions

View File

@@ -69,6 +69,8 @@ export type BaseCommands = {
"codeQL.copyVersion": () => Promise<void>;
"codeQL.restartQueryServer": () => Promise<void>;
"codeQL.restartQueryServerOnConfigChange": () => Promise<void>;
"codeQL.restartLegacyQueryServerOnConfigChange": () => Promise<void>;
};
// Commands used when working with queries in the editor

View File

@@ -169,27 +169,31 @@ function getCommands(
}
};
const restartQueryServer = async () =>
withProgress(
async (progress: ProgressCallback, token: CancellationToken) => {
// Restart all of the spawned servers: cli, query, and language.
cliServer.restartCliServer();
await Promise.all([
queryRunner.restartQueryServer(progress, token),
ideServer.restart(),
]);
void showAndLogInformationMessage("CodeQL Query Server restarted.", {
outputLogger: queryServerLogger,
});
},
{
title: "Restarting Query Server",
},
);
return {
"codeQL.openDocumentation": async () => {
await env.openExternal(Uri.parse("https://codeql.github.com/docs/"));
},
"codeQL.restartQueryServer": async () =>
withProgress(
async (progress: ProgressCallback, token: CancellationToken) => {
// Restart all of the spawned servers: cli, query, and language.
cliServer.restartCliServer();
await Promise.all([
queryRunner.restartQueryServer(progress, token),
ideServer.restart(),
]);
void showAndLogInformationMessage("CodeQL Query Server restarted.", {
outputLogger: queryServerLogger,
});
},
{
title: "Restarting Query Server",
},
),
"codeQL.restartQueryServer": restartQueryServer,
"codeQL.restartQueryServerOnConfigChange": restartQueryServer,
"codeQL.restartLegacyQueryServerOnConfigChange": restartQueryServer,
"codeQL.copyVersion": async () => {
const text = `CodeQL extension version: ${
extension?.packageJSON.version

View File

@@ -71,7 +71,7 @@ export class QueryServerClient extends DisposableObject {
if (config.onDidChangeConfiguration !== undefined) {
this.push(
config.onDidChangeConfiguration(() =>
app.commands.execute("codeQL.restartQueryServer"),
app.commands.execute("codeQL.restartLegacyQueryServerOnConfigChange"),
),
);
}

View File

@@ -68,7 +68,7 @@ export class QueryServerClient extends DisposableObject {
if (config.onDidChangeConfiguration !== undefined) {
this.push(
config.onDidChangeConfiguration(() =>
app.commands.execute("codeQL.restartQueryServer"),
app.commands.execute("codeQL.restartQueryServerOnConfigChange"),
),
);
}