Skip to content

Commit

Permalink
Restart language server on command
Browse files Browse the repository at this point in the history
Ensure that the language server is restarted when the "Restart
Query Server" command is invoked.
  • Loading branch information
aeisenberg committed Mar 24, 2023
1 parent d35ab77 commit 1c06ef9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions extensions/ql-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ function getCommands(
app: App,
cliServer: CodeQLCliServer,
queryRunner: QueryRunner,
ideServer: LanguageClient,
): BaseCommands {
const getCliVersion = async () => {
try {
Expand All @@ -177,9 +178,12 @@ function getCommands(
"codeQL.restartQueryServer": async () =>
withProgress(
async (progress: ProgressCallback, token: CancellationToken) => {
// We restart the CLI server too, to ensure they are the same version
// Restart all of the spawned servers: cli, query, and language.
cliServer.restartCliServer();
await queryRunner.restartQueryServer(progress, token);
await Promise.all([
queryRunner.restartQueryServer(progress, token),
ideServer.restart(),
]);
void showAndLogInformationMessage("CodeQL Query Server restarted.", {
outputLogger: queryServerLogger,
});
Expand Down Expand Up @@ -889,7 +893,7 @@ async function activateWithInstalledDistribution(
void extLogger.log("Registering top-level command palette commands.");

const allCommands: AllExtensionCommands = {
...getCommands(app, cliServer, qs),
...getCommands(app, cliServer, qs, client),
...getQueryEditorCommands({
commandManager: app.commands,
queryRunner: qs,
Expand Down

0 comments on commit 1c06ef9

Please sign in to comment.