Convert codeQLEvalLogViewer.clear to a typed command

This commit is contained in:
Koen Vlaswinkel
2023-03-22 11:34:39 +01:00
parent f196e34fa5
commit aa0d011daa
3 changed files with 14 additions and 7 deletions

View File

@@ -108,10 +108,15 @@ export type DatabasePanelCommands = {
"codeQLVariantAnalysisRepositories.removeItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
};
export type EvalLogViewerCommands = {
"codeQLEvalLogViewer.clear": () => Promise<void>;
};
export type AllCommands = BaseCommands &
QueryHistoryCommands &
LocalDatabasesCommands &
VariantAnalysisCommands &
DatabasePanelCommands;
DatabasePanelCommands &
EvalLogViewerCommands;
export type AppCommandManager = CommandManager<AllCommands>;

View File

@@ -8,11 +8,11 @@ import {
EventEmitter,
TreeItemCollapsibleState,
} from "vscode";
import { commandRunner } from "./commandRunner";
import { DisposableObject } from "./pure/disposable-object";
import { showAndLogExceptionWithTelemetry } from "./helpers";
import { asError, getErrorMessage } from "./pure/helpers-pure";
import { redactableError } from "./pure/errors";
import { EvalLogViewerCommands } from "./common/commands";
export interface EvalLogTreeItem {
label?: string;
@@ -80,11 +80,12 @@ export class EvalLogViewer extends DisposableObject {
this.push(this.treeView);
this.push(this.treeDataProvider);
this.push(
commandRunner("codeQLEvalLogViewer.clear", async () => {
this.clear();
}),
);
}
public getCommands(): EvalLogViewerCommands {
return {
"codeQLEvalLogViewer.clear": async () => this.clear(),
};
}
private clear(): void {

View File

@@ -1102,6 +1102,7 @@ async function activateWithInstalledDistribution(
...variantAnalysisManager.getCommands(),
...databaseUI.getCommands(),
...dbModule.getCommands(),
...evalLogViewer.getCommands(),
};
for (const [commandName, command] of Object.entries(allCommands)) {