Skip to content

Commit 6356149

Browse files
committed
Split viewCfg command
1 parent 7f32439 commit 6356149

2 files changed

Lines changed: 56 additions & 2 deletions

File tree

extensions/ql-vscode/package.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,14 @@
449449
"command": "codeQL.viewCfg",
450450
"title": "CodeQL: View CFG"
451451
},
452+
{
453+
"command": "codeQL.viewCfgContextExplorer",
454+
"title": "CodeQL: View CFG"
455+
},
456+
{
457+
"command": "codeQL.viewCfgContextEditor",
458+
"title": "CodeQL: View CFG"
459+
},
452460
{
453461
"command": "codeQL.upgradeCurrentDatabase",
454462
"title": "CodeQL: Upgrade Current Database"
@@ -947,7 +955,7 @@
947955
"when": "resourceScheme == codeql-zip-archive && !explorerResourceIsFolder && !listMultiSelection"
948956
},
949957
{
950-
"command": "codeQL.viewCfg",
958+
"command": "codeQL.viewCfgContextExplorer",
951959
"group": "9_qlCommands",
952960
"when": "resourceScheme == codeql-zip-archive && config.codeQL.canary"
953961
},
@@ -1032,6 +1040,14 @@
10321040
"command": "codeQL.viewCfg",
10331041
"when": "resourceScheme == codeql-zip-archive && config.codeQL.canary"
10341042
},
1043+
{
1044+
"command": "codeQL.viewCfgContextExplorer",
1045+
"when": "false"
1046+
},
1047+
{
1048+
"command": "codeQL.viewCfgContextEditor",
1049+
"when": "false"
1050+
},
10351051
{
10361052
"command": "codeQLVariantAnalysisRepositories.openConfigFile",
10371053
"when": "false"
@@ -1263,7 +1279,7 @@
12631279
"when": "resourceScheme == codeql-zip-archive"
12641280
},
12651281
{
1266-
"command": "codeQL.viewCfg",
1282+
"command": "codeQL.viewCfgContextEditor",
12671283
"when": "resourceScheme == codeql-zip-archive && config.codeQL.canary"
12681284
},
12691285
{

extensions/ql-vscode/src/extension.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,44 @@ async function activateWithInstalledDistribution(
15761576
),
15771577
);
15781578

1579+
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.viewCfg" command
1580+
ctx.subscriptions.push(
1581+
commandRunnerWithProgress(
1582+
"codeQL.viewCfgContextExplorer",
1583+
async (progress: ProgressCallback, token: CancellationToken) => {
1584+
const res = await cfgTemplateProvider.provideCfgUri(
1585+
window.activeTextEditor?.document,
1586+
);
1587+
if (res) {
1588+
await compileAndRunQuery(false, res[0], progress, token, undefined);
1589+
}
1590+
},
1591+
{
1592+
title: "Calculating Control Flow Graph",
1593+
cancellable: true,
1594+
},
1595+
),
1596+
);
1597+
1598+
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.viewCfg" command
1599+
ctx.subscriptions.push(
1600+
commandRunnerWithProgress(
1601+
"codeQL.viewCfgContextEditor",
1602+
async (progress: ProgressCallback, token: CancellationToken) => {
1603+
const res = await cfgTemplateProvider.provideCfgUri(
1604+
window.activeTextEditor?.document,
1605+
);
1606+
if (res) {
1607+
await compileAndRunQuery(false, res[0], progress, token, undefined);
1608+
}
1609+
},
1610+
{
1611+
title: "Calculating Control Flow Graph",
1612+
cancellable: true,
1613+
},
1614+
),
1615+
);
1616+
15791617
const mockServer = new VSCodeMockGitHubApiServer(ctx);
15801618
ctx.subscriptions.push(mockServer);
15811619
ctx.subscriptions.push(

0 commit comments

Comments
 (0)