Skip to content

Commit

Permalink
Make the command conditional on a supported CLI version
Browse files Browse the repository at this point in the history
  • Loading branch information
d10c committed Oct 12, 2023
1 parent 8b918bd commit b097804
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1810,6 +1810,10 @@
{
"command": "codeQL.gotoQLContextEditor",
"when": "false"
},
{
"command": "codeQL.trimCache",
"when": "codeql.supportsTrimCache"
}
],
"editor/context": [
Expand Down
13 changes: 13 additions & 0 deletions extensions/ql-vscode/src/codeql-cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,13 @@ export class CodeQLCliServer implements Disposable {
CliVersionConstraint.CLI_VERSION_WITH_QUICK_EVAL_COUNT,
) >= 0,
);
await this.app.commands.execute(
"setContext",
"codeql.supportsTrimCache",
newVersion.compare(
CliVersionConstraint.CLI_VERSION_WITH_TRIM_CACHE,
) >= 0,
);
} catch (e) {
this._versionChangedListeners.forEach((listener) =>
listener(undefined),
Expand Down Expand Up @@ -1755,6 +1762,12 @@ export class CliVersionConstraint {
"2.14.0",
);

/**
* CLI version where the query server supports the `evaluation/trimCache` method
* with `codeql database cleanup --mode=trim` semantics.
*/
public static CLI_VERSION_WITH_TRIM_CACHE = new SemVer("2.15.1");

constructor(private readonly cli: CodeQLCliServer) {
/**/
}
Expand Down

0 comments on commit b097804

Please sign in to comment.