Skip to content

Commit 50ec718

Browse files
authored
Implement openQueryResults for variant analysis items (#1654)
1 parent 56af69e commit 50ec718

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -910,8 +910,8 @@ export class QueryHistoryManager extends DisposableObject {
910910
// show original query file on double click
911911
await this.handleOpenQuery(finalSingleItem, [finalSingleItem]);
912912
} else {
913-
// show results on single click only if query is completed successfully.
914-
if (finalSingleItem.status === QueryStatus.Completed) {
913+
// show results on single click (if results view is available)
914+
if (finalSingleItem.t === 'variant-analysis' || finalSingleItem.status === QueryStatus.Completed) {
915915
await this.openQueryResults(finalSingleItem);
916916
}
917917
}
@@ -1439,9 +1439,10 @@ the file in the file explorer and dragging it into the workspace.`
14391439
private async openQueryResults(item: QueryHistoryInfo) {
14401440
if (item.t === 'local') {
14411441
await this.localQueriesResultsView.showResults(item as CompletedLocalQueryInfo, WebviewReveal.Forced, false);
1442-
}
1443-
else if (item.t === 'remote') {
1442+
} else if (item.t === 'remote') {
14441443
await this.remoteQueriesManager.openRemoteQueryResults(item.queryId);
1444+
} else if (item.t === 'variant-analysis') {
1445+
await this.variantAnalysisManager.showView(item.variantAnalysis.id);
14451446
}
14461447
}
14471448
}

extensions/ql-vscode/src/remote-queries/variant-analysis-manager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { CodeQLCliServer } from '../cli';
2525
import { getControllerRepo } from './run-remote-query';
2626
import { processUpdatedVariantAnalysis } from './variant-analysis-processor';
2727
import PQueue from 'p-queue';
28-
import { createTimestampFile } from '../helpers';
28+
import { createTimestampFile, showAndLogErrorMessage } from '../helpers';
2929
import { QueryStatus } from '../query-status';
3030
import * as fs from 'fs-extra';
3131

@@ -73,6 +73,9 @@ export class VariantAnalysisManager extends DisposableObject implements VariantA
7373
}
7474

7575
public async showView(variantAnalysisId: number): Promise<void> {
76+
if (!this.variantAnalyses.get(variantAnalysisId)) {
77+
void showAndLogErrorMessage(`No variant analysis found with id: ${variantAnalysisId}.`);
78+
}
7679
if (!this.views.has(variantAnalysisId)) {
7780
// The view will register itself with the manager, so we don't need to do anything here.
7881
this.push(new VariantAnalysisView(this.ctx, variantAnalysisId, this));

0 commit comments

Comments
 (0)