Skip to content

Commit aa0d011

Browse files
committed
Convert codeQLEvalLogViewer.clear to a typed command
1 parent f196e34 commit aa0d011

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

extensions/ql-vscode/src/common/commands.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,15 @@ export type DatabasePanelCommands = {
108108
"codeQLVariantAnalysisRepositories.removeItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
109109
};
110110

111+
export type EvalLogViewerCommands = {
112+
"codeQLEvalLogViewer.clear": () => Promise<void>;
113+
};
114+
111115
export type AllCommands = BaseCommands &
112116
QueryHistoryCommands &
113117
LocalDatabasesCommands &
114118
VariantAnalysisCommands &
115-
DatabasePanelCommands;
119+
DatabasePanelCommands &
120+
EvalLogViewerCommands;
116121

117122
export type AppCommandManager = CommandManager<AllCommands>;

extensions/ql-vscode/src/eval-log-viewer.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import {
88
EventEmitter,
99
TreeItemCollapsibleState,
1010
} from "vscode";
11-
import { commandRunner } from "./commandRunner";
1211
import { DisposableObject } from "./pure/disposable-object";
1312
import { showAndLogExceptionWithTelemetry } from "./helpers";
1413
import { asError, getErrorMessage } from "./pure/helpers-pure";
1514
import { redactableError } from "./pure/errors";
15+
import { EvalLogViewerCommands } from "./common/commands";
1616

1717
export interface EvalLogTreeItem {
1818
label?: string;
@@ -80,11 +80,12 @@ export class EvalLogViewer extends DisposableObject {
8080

8181
this.push(this.treeView);
8282
this.push(this.treeDataProvider);
83-
this.push(
84-
commandRunner("codeQLEvalLogViewer.clear", async () => {
85-
this.clear();
86-
}),
87-
);
83+
}
84+
85+
public getCommands(): EvalLogViewerCommands {
86+
return {
87+
"codeQLEvalLogViewer.clear": async () => this.clear(),
88+
};
8889
}
8990

9091
private clear(): void {

extensions/ql-vscode/src/extension.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,7 @@ async function activateWithInstalledDistribution(
11021102
...variantAnalysisManager.getCommands(),
11031103
...databaseUI.getCommands(),
11041104
...dbModule.getCommands(),
1105+
...evalLogViewer.getCommands(),
11051106
};
11061107

11071108
for (const [commandName, command] of Object.entries(allCommands)) {

0 commit comments

Comments
 (0)