Merge pull request #2201 from github/koesie10/eval-log-viewer-typed-command

Convert codeQLEvalLogViewer.clear to a typed command
This commit is contained in:
Koen Vlaswinkel
2023-03-22 12:07:34 +01:00
committed by GitHub
3 changed files with 14 additions and 7 deletions

View File

@@ -138,11 +138,16 @@ 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

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