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