Merge pull request #2154 from github/nora/split-commands-b

Extension Telemetry: Split `viewCfg`,`quickEval`, `openReferencedFile` command
This commit is contained in:
Nora
2023-03-10 10:22:33 +01:00
committed by GitHub
2 changed files with 115 additions and 5 deletions

View File

@@ -338,10 +338,22 @@
"command": "codeQL.quickEval",
"title": "CodeQL: Quick Evaluation"
},
{
"command": "codeQL.quickEvalContextEditor",
"title": "CodeQL: Quick Evaluation"
},
{
"command": "codeQL.openReferencedFile",
"title": "CodeQL: Open Referenced File"
},
{
"command": "codeQL.openReferencedFileContextEditor",
"title": "CodeQL: Open Referenced File"
},
{
"command": "codeQL.openReferencedFileContextExplorer",
"title": "CodeQL: Open Referenced File"
},
{
"command": "codeQL.previewQueryHelp",
"title": "CodeQL: Preview Query Help"
@@ -449,6 +461,14 @@
"command": "codeQL.viewCfg",
"title": "CodeQL: View CFG"
},
{
"command": "codeQL.viewCfgContextExplorer",
"title": "CodeQL: View CFG"
},
{
"command": "codeQL.viewCfgContextEditor",
"title": "CodeQL: View CFG"
},
{
"command": "codeQL.upgradeCurrentDatabase",
"title": "CodeQL: Upgrade Current Database"
@@ -947,7 +967,7 @@
"when": "resourceScheme == codeql-zip-archive && !explorerResourceIsFolder && !listMultiSelection"
},
{
"command": "codeQL.viewCfg",
"command": "codeQL.viewCfgContextExplorer",
"group": "9_qlCommands",
"when": "resourceScheme == codeql-zip-archive && config.codeQL.canary"
},
@@ -957,7 +977,7 @@
"when": "resourceScheme != codeql-zip-archive"
},
{
"command": "codeQL.openReferencedFile",
"command": "codeQL.openReferencedFileContextExplorer",
"group": "9_qlCommands",
"when": "resourceExtname == .qlref"
},
@@ -1004,10 +1024,22 @@
"command": "codeQL.quickEval",
"when": "editorLangId == ql"
},
{
"command": "codeQL.quickEvalContextEditor",
"when": "false"
},
{
"command": "codeQL.openReferencedFile",
"when": "resourceExtname == .qlref"
},
{
"command": "codeQL.openReferencedFileContextEditor",
"when": "false"
},
{
"command": "codeQL.openReferencedFileContextExplorer",
"when": "false"
},
{
"command": "codeQL.previewQueryHelp",
"when": "resourceExtname == .qhelp && isWorkspaceTrusted"
@@ -1032,6 +1064,14 @@
"command": "codeQL.viewCfg",
"when": "resourceScheme == codeql-zip-archive && config.codeQL.canary"
},
{
"command": "codeQL.viewCfgContextExplorer",
"when": "false"
},
{
"command": "codeQL.viewCfgContextEditor",
"when": "false"
},
{
"command": "codeQLVariantAnalysisRepositories.openConfigFile",
"when": "false"
@@ -1263,15 +1303,15 @@
"when": "resourceScheme == codeql-zip-archive"
},
{
"command": "codeQL.viewCfg",
"command": "codeQL.viewCfgContextEditor",
"when": "resourceScheme == codeql-zip-archive && config.codeQL.canary"
},
{
"command": "codeQL.quickEval",
"command": "codeQL.quickEvalContextEditor",
"when": "editorLangId == ql"
},
{
"command": "codeQL.openReferencedFile",
"command": "codeQL.openReferencedFileContextEditor",
"when": "resourceExtname == .qlref"
},
{

View File

@@ -1074,6 +1074,7 @@ async function activateWithInstalledDistribution(
queryServerLogger,
),
);
ctx.subscriptions.push(
commandRunnerWithProgress(
"codeQL.quickEval",
@@ -1091,6 +1092,24 @@ async function activateWithInstalledDistribution(
),
);
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.quickEval" command
ctx.subscriptions.push(
commandRunnerWithProgress(
"codeQL.quickEvalContextEditor",
async (
progress: ProgressCallback,
token: CancellationToken,
uri: Uri | undefined,
) => await compileAndRunQuery(true, uri, progress, token, undefined),
{
title: "Running query",
cancellable: true,
},
// Open the query server logger on error since that's usually where the interesting errors appear.
queryServerLogger,
),
);
ctx.subscriptions.push(
commandRunnerWithProgress(
"codeQL.codeLensQuickEval",
@@ -1311,6 +1330,19 @@ async function activateWithInstalledDistribution(
commandRunner("codeQL.openReferencedFile", openReferencedFile),
);
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.openReferencedFile" command
ctx.subscriptions.push(
commandRunner("codeQL.openReferencedFileContextEditor", openReferencedFile),
);
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.openReferencedFile" command
ctx.subscriptions.push(
commandRunner(
"codeQL.openReferencedFileContextExplorer",
openReferencedFile,
),
);
ctx.subscriptions.push(
commandRunner("codeQL.previewQueryHelp", previewQueryHelp),
);
@@ -1576,6 +1608,44 @@ async function activateWithInstalledDistribution(
),
);
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.viewCfg" command
ctx.subscriptions.push(
commandRunnerWithProgress(
"codeQL.viewCfgContextExplorer",
async (progress: ProgressCallback, token: CancellationToken) => {
const res = await cfgTemplateProvider.provideCfgUri(
window.activeTextEditor?.document,
);
if (res) {
await compileAndRunQuery(false, res[0], progress, token, undefined);
}
},
{
title: "Calculating Control Flow Graph",
cancellable: true,
},
),
);
// Since we are tracking extension usage through commands, this command mirrors the "codeQL.viewCfg" command
ctx.subscriptions.push(
commandRunnerWithProgress(
"codeQL.viewCfgContextEditor",
async (progress: ProgressCallback, token: CancellationToken) => {
const res = await cfgTemplateProvider.provideCfgUri(
window.activeTextEditor?.document,
);
if (res) {
await compileAndRunQuery(false, res[0], progress, token, undefined);
}
},
{
title: "Calculating Control Flow Graph",
cancellable: true,
},
),
);
const mockServer = new VSCodeMockGitHubApiServer(ctx);
ctx.subscriptions.push(mockServer);
ctx.subscriptions.push(