Convert handleViewCsvResults to use createSingleSelectionCommand

This commit is contained in:
Robert
2023-04-20 17:27:40 +01:00
parent ef93ab9e70
commit b74cd15752

View File

@@ -280,7 +280,10 @@ export class QueryHistoryManager extends DisposableObject {
this.handleCancel.bind(this),
),
"codeQLQueryHistory.exportResults": this.handleExportResults.bind(this),
"codeQLQueryHistory.viewCsvResults": this.handleViewCsvResults.bind(this),
"codeQLQueryHistory.viewCsvResults": createSingleSelectionCommand(
this.handleViewCsvResults.bind(this),
"query",
),
"codeQLQueryHistory.viewCsvAlerts": this.handleViewCsvAlerts.bind(this),
"codeQLQueryHistory.viewSarifAlerts": createSingleSelectionCommand(
this.handleViewSarifAlerts.bind(this),
@@ -856,19 +859,11 @@ export class QueryHistoryManager extends DisposableObject {
}
}
async handleViewCsvResults(
singleItem: QueryHistoryInfo,
multiSelect: QueryHistoryInfo[] | undefined,
) {
// Local queries only
if (
!this.assertSingleQuery(multiSelect) ||
singleItem.t !== "local" ||
!singleItem.completedQuery
) {
async handleViewCsvResults(item: QueryHistoryInfo) {
if (item.t !== "local" || !item.completedQuery) {
return;
}
const query = singleItem.completedQuery.query;
const query = item.completedQuery.query;
if (await query.hasCsv()) {
void tryOpenExternalFile(this.app.commands, query.csvPath);
return;