Skip to content

Commit d01278d

Browse files
Address PR comments from @aeisenberg and @shati-patel
1 parent 8c1e8a4 commit d01278d

File tree

2 files changed

+23
-31
lines changed

2 files changed

+23
-31
lines changed

extensions/ql-vscode/package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -462,15 +462,15 @@
462462
"title": "Show Query Text"
463463
},
464464
{
465-
"command": "codeQLQueryHistory.exportCsvResults",
466-
"title": "Export Results (CSV)"
465+
"command": "codeQLQueryHistory.viewCsvResults",
466+
"title": "View Results (CSV)"
467467
},
468468
{
469-
"command": "codeQLQueryHistory.viewCsvResults",
469+
"command": "codeQLQueryHistory.viewCsvAlerts",
470470
"title": "View Alerts (CSV)"
471471
},
472472
{
473-
"command": "codeQLQueryHistory.viewSarifResults",
473+
"command": "codeQLQueryHistory.viewSarifAlerts",
474474
"title": "View Alerts (SARIF)"
475475
},
476476
{
@@ -648,17 +648,17 @@
648648
"when": "view == codeQLQueryHistory"
649649
},
650650
{
651-
"command": "codeQLQueryHistory.exportCsvResults",
651+
"command": "codeQLQueryHistory.viewCsvResults",
652652
"group": "9_qlCommands",
653653
"when": "view == codeQLQueryHistory && viewItem != interpretedResultsItem"
654654
},
655655
{
656-
"command": "codeQLQueryHistory.viewCsvResults",
656+
"command": "codeQLQueryHistory.viewCsvAlerts",
657657
"group": "9_qlCommands",
658658
"when": "view == codeQLQueryHistory && viewItem == interpretedResultsItem"
659659
},
660660
{
661-
"command": "codeQLQueryHistory.viewSarifResults",
661+
"command": "codeQLQueryHistory.viewSarifAlerts",
662662
"group": "9_qlCommands",
663663
"when": "view == codeQLQueryHistory && viewItem == interpretedResultsItem"
664664
},
@@ -810,15 +810,15 @@
810810
"when": "false"
811811
},
812812
{
813-
"command": "codeQLQueryHistory.exportCsvResults",
813+
"command": "codeQLQueryHistory.viewCsvResults",
814814
"when": "false"
815815
},
816816
{
817-
"command": "codeQLQueryHistory.viewCsvResults",
817+
"command": "codeQLQueryHistory.viewCsvAlerts",
818818
"when": "false"
819819
},
820820
{
821-
"command": "codeQLQueryHistory.viewSarifResults",
821+
"command": "codeQLQueryHistory.viewSarifAlerts",
822822
"when": "false"
823823
},
824824
{

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

+13-21
Original file line numberDiff line numberDiff line change
@@ -306,20 +306,20 @@ export class QueryHistoryManager extends DisposableObject {
306306
);
307307
this.push(
308308
commandRunner(
309-
'codeQLQueryHistory.exportCsvResults',
310-
this.handleExportCsvResults.bind(this)
309+
'codeQLQueryHistory.viewCsvResults',
310+
this.handleViewCsvResults.bind(this)
311311
)
312312
);
313313
this.push(
314314
commandRunner(
315-
'codeQLQueryHistory.viewCsvResults',
316-
this.handleViewCsvResults.bind(this)
315+
'codeQLQueryHistory.viewCsvAlerts',
316+
this.handleViewCsvAlerts.bind(this)
317317
)
318318
);
319319
this.push(
320320
commandRunner(
321-
'codeQLQueryHistory.viewSarifResults',
322-
this.handleViewSarifResults.bind(this)
321+
'codeQLQueryHistory.viewSarifAlerts',
322+
this.handleViewSarifAlerts.bind(this)
323323
)
324324
);
325325
this.push(
@@ -556,7 +556,7 @@ export class QueryHistoryManager extends DisposableObject {
556556
await vscode.window.showTextDocument(doc, { preview: false });
557557
}
558558

559-
async handleViewSarifResults(
559+
async handleViewSarifAlerts(
560560
singleItem: CompletedQuery,
561561
multiSelect: CompletedQuery[]
562562
) {
@@ -577,33 +577,25 @@ export class QueryHistoryManager extends DisposableObject {
577577
}
578578
}
579579

580-
async handleExportCsvResults(
580+
async handleViewCsvResults(
581581
singleItem: CompletedQuery,
582582
multiSelect: CompletedQuery[]
583583
) {
584584
if (!this.assertSingleQuery(multiSelect)) {
585585
return;
586586
}
587-
588-
const saveLocation = await vscode.window.showSaveDialog({
589-
title: 'CSV Results',
590-
saveLabel: 'Export',
591-
filters: {
592-
'Comma-separated values': ['csv'],
593-
}
594-
});
595-
if (!saveLocation) {
596-
void showAndLogErrorMessage('No save location selected for CSV export!');
587+
if (await singleItem.query.hasCsv()) {
588+
void this.tryOpenExternalFile(singleItem.query.csvPath);
597589
return;
598590
}
599-
await singleItem.query.exportCsvResults(this.qs, saveLocation.fsPath, () => {
591+
await singleItem.query.exportCsvResults(this.qs, singleItem.query.csvPath, () => {
600592
void this.tryOpenExternalFile(
601-
saveLocation.fsPath
593+
singleItem.query.csvPath
602594
);
603595
});
604596
}
605597

606-
async handleViewCsvResults(
598+
async handleViewCsvAlerts(
607599
singleItem: CompletedQuery,
608600
multiSelect: CompletedQuery[]
609601
) {

0 commit comments

Comments
 (0)