Skip to content

Commit 1ea0f14

Browse files
Convert handleViewDil to use createSingleSelectionCommand
1 parent 9c711ed commit 1ea0f14

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

extensions/ql-vscode/src/query-history/query-history-manager.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,10 @@ export class QueryHistoryManager extends DisposableObject {
292292
this.handleViewSarifAlerts.bind(this),
293293
"query",
294294
),
295-
"codeQLQueryHistory.viewDil": this.handleViewDil.bind(this),
295+
"codeQLQueryHistory.viewDil": createSingleSelectionCommand(
296+
this.handleViewDil.bind(this),
297+
"query",
298+
),
296299
"codeQLQueryHistory.itemClicked": createSingleSelectionCommand(
297300
this.handleItemClicked.bind(this),
298301
"query",
@@ -890,22 +893,14 @@ export class QueryHistoryManager extends DisposableObject {
890893
);
891894
}
892895

893-
async handleViewDil(
894-
singleItem: QueryHistoryInfo,
895-
multiSelect: QueryHistoryInfo[] | undefined,
896-
) {
897-
// Local queries only
898-
if (
899-
!this.assertSingleQuery(multiSelect) ||
900-
singleItem.t !== "local" ||
901-
!singleItem.completedQuery
902-
) {
896+
async handleViewDil(item: QueryHistoryInfo) {
897+
if (item.t !== "local" || !item.completedQuery) {
903898
return;
904899
}
905900

906901
await tryOpenExternalFile(
907902
this.app.commands,
908-
await singleItem.completedQuery.query.ensureDilPath(this.qs.cliServer),
903+
await item.completedQuery.query.ensureDilPath(this.qs.cliServer),
909904
);
910905
}
911906

0 commit comments

Comments
 (0)