Skip to content

Commit db0fbaa

Browse files
committed
Add a new canary flag to enable new query server support
1 parent 176fac0 commit db0fbaa

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

extensions/ql-vscode/src/cli.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { promisify } from 'util';
1111
import { CancellationToken, commands, Disposable, Uri } from 'vscode';
1212

1313
import { BQRSInfo, DecodedBqrsChunk } from './pure/bqrs-cli-types';
14-
import { CliConfig } from './config';
14+
import { allowCanaryQueryServer, CliConfig } from './config';
1515
import { DistributionProvider, FindDistributionResultKind } from './distribution';
1616
import { assertNever, getErrorMessage, getErrorStack } from './pure/helpers-pure';
1717
import { QueryMetadata, SortDirection } from './pure/interface-types';
@@ -1330,6 +1330,11 @@ export class CliVersionConstraint {
13301330
*/
13311331
public static CLI_VERSION_WITH_SOURCEMAP = new SemVer('2.10.3');
13321332

1333+
/**
1334+
* CLI version that supports the new query server.
1335+
*/
1336+
public static CLI_VERSION_WITH_NEW_QUERY_SERVER = new SemVer('2.11.0');
1337+
13331338
constructor(private readonly cli: CodeQLCliServer) {
13341339
/**/
13351340
}
@@ -1407,7 +1412,10 @@ export class CliVersionConstraint {
14071412
}
14081413

14091414
async supportsNewQueryServer() {
1410-
// return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_WITH_NEW_QUERY_SERVER);
1411-
return true;
1415+
// TODO while under development, users _must_ opt-in to the new query server
1416+
// by setting the `codeql.canaryQueryServer` setting to `true`.
1417+
// Ignore the version check for now.
1418+
return allowCanaryQueryServer();
1419+
// return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_WITH_NEW_QUERY_SERVER);
14121420
}
14131421
}

extensions/ql-vscode/src/config.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,17 @@ export function isCanary() {
317317
return !!CANARY_FEATURES.getValue<boolean>();
318318
}
319319

320+
/**
321+
* Enables the experimental query server
322+
*/
323+
export const CANARY_QUERY_SERVER = new Setting('canaryQueryServer', ROOT_SETTING);
324+
325+
326+
export function allowCanaryQueryServer() {
327+
return !!CANARY_QUERY_SERVER.getValue<boolean>();
328+
}
329+
330+
320331
/**
321332
* Avoids caching in the AST viewer if the user is also a canary user.
322333
*/
@@ -343,12 +354,12 @@ export async function setRemoteRepositoryLists(lists: Record<string, string[]> |
343354
}
344355

345356
/**
346-
* Path to a file that contains lists of GitHub repositories that you want to query remotely via
357+
* Path to a file that contains lists of GitHub repositories that you want to query remotely via
347358
* the "Run Variant Analysis" command.
348359
* Note: This command is only available for internal users.
349-
*
360+
*
350361
* This setting should be a path to a JSON file that contains a JSON object where each key is a
351-
* user-specified name (string), and the value is an array of GitHub repositories
362+
* user-specified name (string), and the value is an array of GitHub repositories
352363
* (of the form `<owner>/<repo>`).
353364
*/
354365
const REPO_LISTS_PATH = new Setting('repositoryListsPath', REMOTE_QUERIES_SETTING);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class QueryServerClient extends DisposableObject {
158158
callback(res);
159159
}
160160
});
161-
this.serverProcess = new ServerProcess(child, connection, this.logger);
161+
this.serverProcess = new ServerProcess(child, connection, 'Query Server 2', this.logger);
162162
// Ensure the server process is disposed together with this client.
163163
this.track(this.serverProcess);
164164
connection.listen();
@@ -201,4 +201,3 @@ export class QueryServerClient extends DisposableObject {
201201
}
202202
}
203203
}
204-

0 commit comments

Comments
 (0)