Split variant analysis and extension commands
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
import { CommandManager } from "../packages/commands";
|
||||
|
||||
export type ExtensionCommands = {
|
||||
"codeQL.openDocumentation": () => Promise<void>;
|
||||
};
|
||||
|
||||
export type VariantAnalysisCommands = {
|
||||
"codeQL.openVariantAnalysisLogs": (
|
||||
variantAnalysisId: number,
|
||||
) => Promise<void>;
|
||||
};
|
||||
|
||||
export type AllCommands = ExtensionCommands;
|
||||
export type AllCommands = ExtensionCommands & VariantAnalysisCommands;
|
||||
|
||||
export type ExtensionCommandManager = CommandManager<AllCommands>;
|
||||
|
||||
@@ -169,12 +169,10 @@ let isInstallingOrUpdatingDistribution = false;
|
||||
const extensionId = "GitHub.vscode-codeql";
|
||||
const extension = extensions.getExtension(extensionId);
|
||||
|
||||
function getCommands(
|
||||
variantAnalysisManager: VariantAnalysisManager,
|
||||
): ExtensionCommands {
|
||||
function getCommands(): ExtensionCommands {
|
||||
return {
|
||||
"codeQL.openVariantAnalysisLogs": async (variantAnalysisId: number) => {
|
||||
await variantAnalysisManager.openVariantAnalysisLogs(variantAnalysisId);
|
||||
"codeQL.openDocumentation": async () => {
|
||||
await env.openExternal(Uri.parse("https://codeql.github.com/docs/"));
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1164,19 +1162,9 @@ async function activateWithInstalledDistribution(
|
||||
),
|
||||
);
|
||||
|
||||
/*
|
||||
ctx.subscriptions.push(
|
||||
commandRunner(
|
||||
"codeQL.openVariantAnalysisLogs",
|
||||
async (variantAnalysisId: number) => {
|
||||
await variantAnalysisManager.openVariantAnalysisLogs(variantAnalysisId);
|
||||
},
|
||||
),
|
||||
);
|
||||
*/
|
||||
|
||||
const allCommands: Partial<AllCommands> = {
|
||||
...getCommands(variantAnalysisManager),
|
||||
const allCommands: AllCommands = {
|
||||
...getCommands(),
|
||||
...variantAnalysisManager.getCommands(),
|
||||
};
|
||||
|
||||
for (const [commandName, command] of Object.entries(allCommands)) {
|
||||
@@ -1383,12 +1371,6 @@ async function activateWithInstalledDistribution(
|
||||
),
|
||||
);
|
||||
|
||||
ctx.subscriptions.push(
|
||||
commandRunner("codeQL.openDocumentation", async () =>
|
||||
env.openExternal(Uri.parse("https://codeql.github.com/docs/")),
|
||||
),
|
||||
);
|
||||
|
||||
ctx.subscriptions.push(
|
||||
commandRunner("codeQL.copyVersion", async () => {
|
||||
const text = `CodeQL extension version: ${
|
||||
|
||||
@@ -62,6 +62,7 @@ import { URLSearchParams } from "url";
|
||||
import { DbManager } from "../databases/db-manager";
|
||||
import { App } from "../common/app";
|
||||
import { redactableError } from "../pure/errors";
|
||||
import { VariantAnalysisCommands } from "../common/commands";
|
||||
|
||||
export class VariantAnalysisManager
|
||||
extends DisposableObject
|
||||
@@ -123,6 +124,14 @@ export class VariantAnalysisManager
|
||||
);
|
||||
}
|
||||
|
||||
getCommands(): VariantAnalysisCommands {
|
||||
return {
|
||||
"codeQL.openVariantAnalysisLogs": async (variantAnalysisId: number) => {
|
||||
await this.openVariantAnalysisLogs(variantAnalysisId);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public async runVariantAnalysis(
|
||||
uri: Uri | undefined,
|
||||
progress: ProgressCallback,
|
||||
|
||||
Reference in New Issue
Block a user