Merge pull request #2235 from github/robertbrignull/use_app_commands_5
Convert call sites to use typed commands (part 5): VariantAnalysisView
This commit is contained in:
Коммит
d35ab77aaf
|
@ -358,7 +358,10 @@ export async function activate(
|
|||
),
|
||||
);
|
||||
|
||||
const variantAnalysisViewSerializer = new VariantAnalysisViewSerializer(ctx);
|
||||
const variantAnalysisViewSerializer = new VariantAnalysisViewSerializer(
|
||||
ctx,
|
||||
app,
|
||||
);
|
||||
Window.registerWebviewPanelSerializer(
|
||||
VariantAnalysisView.viewType,
|
||||
variantAnalysisViewSerializer,
|
||||
|
|
|
@ -317,7 +317,9 @@ export class VariantAnalysisManager
|
|||
}
|
||||
if (!this.views.has(variantAnalysisId)) {
|
||||
// The view will register itself with the manager, so we don't need to do anything here.
|
||||
this.track(new VariantAnalysisView(this.ctx, variantAnalysisId, this));
|
||||
this.track(
|
||||
new VariantAnalysisView(this.ctx, this.app, variantAnalysisId, this),
|
||||
);
|
||||
}
|
||||
|
||||
const variantAnalysisView = this.views.get(variantAnalysisId)!;
|
||||
|
|
|
@ -2,6 +2,7 @@ import { ExtensionContext, WebviewPanel, WebviewPanelSerializer } from "vscode";
|
|||
import { VariantAnalysisView } from "./variant-analysis-view";
|
||||
import { VariantAnalysisState } from "../pure/interface-types";
|
||||
import { VariantAnalysisViewManager } from "./variant-analysis-view-manager";
|
||||
import { App } from "../common/app";
|
||||
|
||||
export class VariantAnalysisViewSerializer implements WebviewPanelSerializer {
|
||||
private resolvePromises: Array<
|
||||
|
@ -10,7 +11,10 @@ export class VariantAnalysisViewSerializer implements WebviewPanelSerializer {
|
|||
|
||||
private manager?: VariantAnalysisViewManager<VariantAnalysisView>;
|
||||
|
||||
public constructor(private readonly ctx: ExtensionContext) {}
|
||||
public constructor(
|
||||
private readonly ctx: ExtensionContext,
|
||||
private readonly app: App,
|
||||
) {}
|
||||
|
||||
onExtensionLoaded(
|
||||
manager: VariantAnalysisViewManager<VariantAnalysisView>,
|
||||
|
@ -49,6 +53,7 @@ export class VariantAnalysisViewSerializer implements WebviewPanelSerializer {
|
|||
|
||||
const view = new VariantAnalysisView(
|
||||
this.ctx,
|
||||
this.app,
|
||||
variantAnalysisState.variantAnalysisId,
|
||||
manager,
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { commands, ExtensionContext, ViewColumn } from "vscode";
|
||||
import { ExtensionContext, ViewColumn } from "vscode";
|
||||
import { AbstractWebview, WebviewPanelConfig } from "../abstract-webview";
|
||||
import { extLogger } from "../common";
|
||||
import {
|
||||
|
@ -23,6 +23,7 @@ import { telemetryListener } from "../telemetry";
|
|||
import { redactableError } from "../pure/errors";
|
||||
import { DataFlowPathsView } from "./data-flow-paths-view";
|
||||
import { DataFlowPaths } from "./shared/data-flow-paths";
|
||||
import { App } from "../common/app";
|
||||
|
||||
export class VariantAnalysisView
|
||||
extends AbstractWebview<ToVariantAnalysisMessage, FromVariantAnalysisMessage>
|
||||
|
@ -33,6 +34,7 @@ export class VariantAnalysisView
|
|||
|
||||
public constructor(
|
||||
ctx: ExtensionContext,
|
||||
private readonly app: App,
|
||||
public readonly variantAnalysisId: number,
|
||||
private readonly manager: VariantAnalysisViewManager<VariantAnalysisView>,
|
||||
) {
|
||||
|
@ -118,7 +120,7 @@ export class VariantAnalysisView
|
|||
await this.manager.cancelVariantAnalysis(this.variantAnalysisId);
|
||||
break;
|
||||
case "requestRepositoryResults":
|
||||
void commands.executeCommand(
|
||||
void this.app.commands.execute(
|
||||
"codeQL.loadVariantAnalysisRepoResults",
|
||||
this.variantAnalysisId,
|
||||
msg.repositoryFullName,
|
||||
|
@ -131,7 +133,7 @@ export class VariantAnalysisView
|
|||
await this.manager.openQueryText(this.variantAnalysisId);
|
||||
break;
|
||||
case "copyRepositoryList":
|
||||
void commands.executeCommand(
|
||||
void this.app.commands.execute(
|
||||
"codeQL.copyVariantAnalysisRepoList",
|
||||
this.variantAnalysisId,
|
||||
msg.filterSort,
|
||||
|
|
Загрузка…
Ссылка в новой задаче