Skip to content

Commit 71831fe

Browse files
authored
Merge pull request #2201 from github/koesie10/eval-log-viewer-typed-command
Convert codeQLEvalLogViewer.clear to a typed command
2 parents 56c83eb + aa0d011 commit 71831fe

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
@@ -138,11 +138,16 @@ export type DatabasePanelCommands = {
138138
"codeQLVariantAnalysisRepositories.removeItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
139139
};
140140

141+
export type EvalLogViewerCommands = {
142+
"codeQLEvalLogViewer.clear": () => Promise<void>;
143+
};
144+
141145
export type AllCommands = BaseCommands &
142146
QueryHistoryCommands &
143147
LocalDatabasesCommands &
144148
VariantAnalysisCommands &
145-
DatabasePanelCommands;
149+
DatabasePanelCommands &
150+
EvalLogViewerCommands;
146151

147152
export type AppCommandManager = CommandManager<AllCommands>;
148153

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
@@ -804,6 +804,7 @@ async function activateWithInstalledDistribution(
804804
...variantAnalysisManager.getCommands(),
805805
...databaseUI.getCommands(),
806806
...dbModule.getCommands(),
807+
...evalLogViewer.getCommands(),
807808
};
808809

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

0 commit comments

Comments
 (0)