Skip to content

Commit 145764c

Browse files
Split up codeQL.restartQueryServer command
1 parent 9015a57 commit 145764c

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ export type BaseCommands = {
6969

7070
"codeQL.copyVersion": () => Promise<void>;
7171
"codeQL.restartQueryServer": () => Promise<void>;
72+
"codeQL.restartQueryServerOnConfigChange": () => Promise<void>;
73+
"codeQL.restartLegacyQueryServerOnConfigChange": () => Promise<void>;
7274
};
7375

7476
// Commands used when working with queries in the editor

extensions/ql-vscode/src/extension.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,27 +169,31 @@ function getCommands(
169169
}
170170
};
171171

172+
const restartQueryServer = async () =>
173+
withProgress(
174+
async (progress: ProgressCallback, token: CancellationToken) => {
175+
// Restart all of the spawned servers: cli, query, and language.
176+
cliServer.restartCliServer();
177+
await Promise.all([
178+
queryRunner.restartQueryServer(progress, token),
179+
ideServer.restart(),
180+
]);
181+
void showAndLogInformationMessage("CodeQL Query Server restarted.", {
182+
outputLogger: queryServerLogger,
183+
});
184+
},
185+
{
186+
title: "Restarting Query Server",
187+
},
188+
);
189+
172190
return {
173191
"codeQL.openDocumentation": async () => {
174192
await env.openExternal(Uri.parse("https://codeql.github.com/docs/"));
175193
},
176-
"codeQL.restartQueryServer": async () =>
177-
withProgress(
178-
async (progress: ProgressCallback, token: CancellationToken) => {
179-
// Restart all of the spawned servers: cli, query, and language.
180-
cliServer.restartCliServer();
181-
await Promise.all([
182-
queryRunner.restartQueryServer(progress, token),
183-
ideServer.restart(),
184-
]);
185-
void showAndLogInformationMessage("CodeQL Query Server restarted.", {
186-
outputLogger: queryServerLogger,
187-
});
188-
},
189-
{
190-
title: "Restarting Query Server",
191-
},
192-
),
194+
"codeQL.restartQueryServer": restartQueryServer,
195+
"codeQL.restartQueryServerOnConfigChange": restartQueryServer,
196+
"codeQL.restartLegacyQueryServerOnConfigChange": restartQueryServer,
193197
"codeQL.copyVersion": async () => {
194198
const text = `CodeQL extension version: ${
195199
extension?.packageJSON.version

extensions/ql-vscode/src/legacy-query-server/queryserver-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class QueryServerClient extends DisposableObject {
7171
if (config.onDidChangeConfiguration !== undefined) {
7272
this.push(
7373
config.onDidChangeConfiguration(() =>
74-
app.commands.execute("codeQL.restartQueryServer"),
74+
app.commands.execute("codeQL.restartLegacyQueryServerOnConfigChange"),
7575
),
7676
);
7777
}

extensions/ql-vscode/src/query-server/queryserver-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class QueryServerClient extends DisposableObject {
6868
if (config.onDidChangeConfiguration !== undefined) {
6969
this.push(
7070
config.onDidChangeConfiguration(() =>
71-
app.commands.execute("codeQL.restartQueryServer"),
71+
app.commands.execute("codeQL.restartQueryServerOnConfigChange"),
7272
),
7373
);
7474
}

0 commit comments

Comments
 (0)