Skip to content

Commit b097804

Browse files
committed
Make the command conditional on a supported CLI version
1 parent 8b918bd commit b097804

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

extensions/ql-vscode/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,10 @@
18101810
{
18111811
"command": "codeQL.gotoQLContextEditor",
18121812
"when": "false"
1813+
},
1814+
{
1815+
"command": "codeQL.trimCache",
1816+
"when": "codeql.supportsTrimCache"
18131817
}
18141818
],
18151819
"editor/context": [

extensions/ql-vscode/src/codeql-cli/cli.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,13 @@ export class CodeQLCliServer implements Disposable {
14921492
CliVersionConstraint.CLI_VERSION_WITH_QUICK_EVAL_COUNT,
14931493
) >= 0,
14941494
);
1495+
await this.app.commands.execute(
1496+
"setContext",
1497+
"codeql.supportsTrimCache",
1498+
newVersion.compare(
1499+
CliVersionConstraint.CLI_VERSION_WITH_TRIM_CACHE,
1500+
) >= 0,
1501+
);
14951502
} catch (e) {
14961503
this._versionChangedListeners.forEach((listener) =>
14971504
listener(undefined),
@@ -1755,6 +1762,12 @@ export class CliVersionConstraint {
17551762
"2.14.0",
17561763
);
17571764

1765+
/**
1766+
* CLI version where the query server supports the `evaluation/trimCache` method
1767+
* with `codeql database cleanup --mode=trim` semantics.
1768+
*/
1769+
public static CLI_VERSION_WITH_TRIM_CACHE = new SemVer("2.15.1");
1770+
17581771
constructor(private readonly cli: CodeQLCliServer) {
17591772
/**/
17601773
}

0 commit comments

Comments
 (0)