Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart language server on command #2238

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [UNRELEASED]

- Restart the CodeQL language server whenever the _CodeQL: Restart Query Server_ command is invoked. This avoids bugs where the CLI version changes to support new language features, but the language server is not updated. [#2238](https://github.com/github/vscode-codeql/pull/2238)

## 1.8.1 - 23 March 2023

- Show data flow paths of a variant analysis in a new tab. [#2172](https://github.com/github/vscode-codeql/pull/2172) & [#2182](https://github.com/github/vscode-codeql/pull/2182)
Expand Down
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(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right.

]);
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