Convert handleShowQueryLog to use createSingleSelectionCommand
This commit is contained in:
@@ -257,7 +257,10 @@ export class QueryHistoryManager extends DisposableObject {
|
|||||||
this.handleShowEvalLogSummary.bind(this),
|
this.handleShowEvalLogSummary.bind(this),
|
||||||
"codeQLQueryHistory.showEvalLogViewer":
|
"codeQLQueryHistory.showEvalLogViewer":
|
||||||
this.handleShowEvalLogViewer.bind(this),
|
this.handleShowEvalLogViewer.bind(this),
|
||||||
"codeQLQueryHistory.showQueryLog": this.handleShowQueryLog.bind(this),
|
"codeQLQueryHistory.showQueryLog": createSingleSelectionCommand(
|
||||||
|
this.handleShowQueryLog.bind(this),
|
||||||
|
"query",
|
||||||
|
),
|
||||||
"codeQLQueryHistory.showQueryText": this.handleShowQueryText.bind(this),
|
"codeQLQueryHistory.showQueryText": this.handleShowQueryText.bind(this),
|
||||||
"codeQLQueryHistory.openQueryDirectory":
|
"codeQLQueryHistory.openQueryDirectory":
|
||||||
this.handleOpenQueryDirectory.bind(this),
|
this.handleOpenQueryDirectory.bind(this),
|
||||||
@@ -624,23 +627,16 @@ export class QueryHistoryManager extends DisposableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleShowQueryLog(
|
async handleShowQueryLog(item: QueryHistoryInfo) {
|
||||||
singleItem: QueryHistoryInfo,
|
|
||||||
multiSelect: QueryHistoryInfo[] | undefined,
|
|
||||||
) {
|
|
||||||
// Local queries only
|
// Local queries only
|
||||||
if (!this.assertSingleQuery(multiSelect) || singleItem?.t !== "local") {
|
if (item?.t !== "local" || !item.completedQuery) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!singleItem.completedQuery) {
|
if (item.completedQuery.logFileLocation) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (singleItem.completedQuery.logFileLocation) {
|
|
||||||
await tryOpenExternalFile(
|
await tryOpenExternalFile(
|
||||||
this.app.commands,
|
this.app.commands,
|
||||||
singleItem.completedQuery.logFileLocation,
|
item.completedQuery.logFileLocation,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
void showAndLogWarningMessage("No log file available");
|
void showAndLogWarningMessage("No log file available");
|
||||||
|
|||||||
Reference in New Issue
Block a user