Merge pull request #2198 from github/koesie10/packaging-typed-commands
Convert packaging to typed commands
This commit is contained in:
@@ -167,6 +167,11 @@ export type DatabasePanelCommands = {
|
|||||||
"codeQLVariantAnalysisRepositories.removeItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
|
"codeQLVariantAnalysisRepositories.removeItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type PackagingCommands = {
|
||||||
|
"codeQL.installPackDependencies": () => Promise<void>;
|
||||||
|
"codeQL.downloadPacks": () => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
export type EvalLogViewerCommands = {
|
export type EvalLogViewerCommands = {
|
||||||
"codeQLEvalLogViewer.clear": () => Promise<void>;
|
"codeQLEvalLogViewer.clear": () => Promise<void>;
|
||||||
};
|
};
|
||||||
@@ -176,6 +181,7 @@ export type AllCommands = BaseCommands &
|
|||||||
LocalDatabasesCommands &
|
LocalDatabasesCommands &
|
||||||
VariantAnalysisCommands &
|
VariantAnalysisCommands &
|
||||||
DatabasePanelCommands &
|
DatabasePanelCommands &
|
||||||
|
PackagingCommands &
|
||||||
EvalLogViewerCommands;
|
EvalLogViewerCommands;
|
||||||
|
|
||||||
export type AppCommandManager = CommandManager<AllCommands>;
|
export type AppCommandManager = CommandManager<AllCommands>;
|
||||||
|
|||||||
@@ -96,10 +96,7 @@ import {
|
|||||||
withProgress,
|
withProgress,
|
||||||
} from "./commandRunner";
|
} from "./commandRunner";
|
||||||
import { CodeQlStatusBarHandler } from "./status-bar";
|
import { CodeQlStatusBarHandler } from "./status-bar";
|
||||||
import {
|
import { getPackagingCommands } from "./packaging";
|
||||||
handleDownloadPacks,
|
|
||||||
handleInstallPackDependencies,
|
|
||||||
} from "./packaging";
|
|
||||||
import { HistoryItemLabelProvider } from "./query-history/history-item-label-provider";
|
import { HistoryItemLabelProvider } from "./query-history/history-item-label-provider";
|
||||||
import { EvalLogViewer } from "./eval-log-viewer";
|
import { EvalLogViewer } from "./eval-log-viewer";
|
||||||
import { SummaryLanguageSupport } from "./log-insights/summary-language-support";
|
import { SummaryLanguageSupport } from "./log-insights/summary-language-support";
|
||||||
@@ -815,6 +812,9 @@ async function activateWithInstalledDistribution(
|
|||||||
...variantAnalysisManager.getCommands(),
|
...variantAnalysisManager.getCommands(),
|
||||||
...databaseUI.getCommands(),
|
...databaseUI.getCommands(),
|
||||||
...dbModule.getCommands(),
|
...dbModule.getCommands(),
|
||||||
|
...getPackagingCommands({
|
||||||
|
cliServer,
|
||||||
|
}),
|
||||||
...evalLogViewer.getCommands(),
|
...evalLogViewer.getCommands(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -906,28 +906,6 @@ async function activateWithInstalledDistribution(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
ctx.subscriptions.push(
|
|
||||||
commandRunnerWithProgress(
|
|
||||||
"codeQL.installPackDependencies",
|
|
||||||
async (progress: ProgressCallback) =>
|
|
||||||
await handleInstallPackDependencies(cliServer, progress),
|
|
||||||
{
|
|
||||||
title: "Installing pack dependencies",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
ctx.subscriptions.push(
|
|
||||||
commandRunnerWithProgress(
|
|
||||||
"codeQL.downloadPacks",
|
|
||||||
async (progress: ProgressCallback) =>
|
|
||||||
await handleDownloadPacks(cliServer, progress),
|
|
||||||
{
|
|
||||||
title: "Downloading packs",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
ctx.subscriptions.push(
|
ctx.subscriptions.push(
|
||||||
commandRunner("codeQL.showLogs", async () => {
|
commandRunner("codeQL.showLogs", async () => {
|
||||||
extLogger.show();
|
extLogger.show();
|
||||||
|
|||||||
@@ -5,11 +5,43 @@ import {
|
|||||||
showAndLogInformationMessage,
|
showAndLogInformationMessage,
|
||||||
} from "./helpers";
|
} from "./helpers";
|
||||||
import { QuickPickItem, window } from "vscode";
|
import { QuickPickItem, window } from "vscode";
|
||||||
import { ProgressCallback, UserCancellationException } from "./commandRunner";
|
import {
|
||||||
|
ProgressCallback,
|
||||||
|
UserCancellationException,
|
||||||
|
withProgress,
|
||||||
|
} from "./commandRunner";
|
||||||
import { extLogger } from "./common";
|
import { extLogger } from "./common";
|
||||||
import { asError, getErrorStack } from "./pure/helpers-pure";
|
import { asError, getErrorStack } from "./pure/helpers-pure";
|
||||||
import { redactableError } from "./pure/errors";
|
import { redactableError } from "./pure/errors";
|
||||||
import { PACKS_BY_QUERY_LANGUAGE } from "./common/query-language";
|
import { PACKS_BY_QUERY_LANGUAGE } from "./common/query-language";
|
||||||
|
import { PackagingCommands } from "./common/commands";
|
||||||
|
|
||||||
|
type PackagingOptions = {
|
||||||
|
cliServer: CodeQLCliServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getPackagingCommands({
|
||||||
|
cliServer,
|
||||||
|
}: PackagingOptions): PackagingCommands {
|
||||||
|
return {
|
||||||
|
"codeQL.installPackDependencies": async () =>
|
||||||
|
withProgress(
|
||||||
|
async (progress: ProgressCallback) =>
|
||||||
|
await handleInstallPackDependencies(cliServer, progress),
|
||||||
|
{
|
||||||
|
title: "Installing pack dependencies",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"codeQL.downloadPacks": async () =>
|
||||||
|
withProgress(
|
||||||
|
async (progress: ProgressCallback) =>
|
||||||
|
await handleDownloadPacks(cliServer, progress),
|
||||||
|
{
|
||||||
|
title: "Downloading packs",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompts user to choose packs to download, and downloads them.
|
* Prompts user to choose packs to download, and downloads them.
|
||||||
|
|||||||
Reference in New Issue
Block a user