Skip to content

Commit eb44a90

Browse files
committed
Add codeQL.cliFeatures.* context keys
1 parent bb2f7d0 commit eb44a90

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

extensions/ql-vscode/src/extension.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,25 @@ export async function activate(
463463
);
464464
unsupportedWarningShown = true;
465465
});
466+
467+
// Expose the CodeQL CLI features to the extension context under `codeQL.cliFeatures.*`.
468+
let cliFeatures: { [feature: string]: boolean | undefined } = {};
469+
codeQlExtension.cliServer.addVersionChangedListener(async (ver) => {
470+
for (const feat of Object.keys(cliFeatures)) {
471+
cliFeatures[feat] = false;
472+
}
473+
cliFeatures = {
474+
...cliFeatures,
475+
...(ver?.features ?? {}),
476+
};
477+
for (const feat of Object.keys(cliFeatures)) {
478+
await app.commands.execute(
479+
"setContext",
480+
`codeQL.cliFeatures.${feat}`,
481+
cliFeatures[feat] ?? false,
482+
);
483+
}
484+
});
466485
}
467486

468487
return codeQlExtension;

0 commit comments

Comments
 (0)