Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion extensions/ql-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,15 @@ async function activateWithInstalledDistribution(

ctx.subscriptions.push(
commandRunner('codeQL.mockVariantAnalysisView', async () => {
const variantAnalysisView = new VariantAnalysisView(ctx);
const variantAnalysisView = new VariantAnalysisView(ctx, 1);
variantAnalysisView.openView();
})
);

// The "openVariantAnalysisView" command is internal-only.
ctx.subscriptions.push(
commandRunner('codeQL.openVariantAnalysisView', async (variantAnalysisId: number) => {
const variantAnalysisView = new VariantAnalysisView(ctx, variantAnalysisId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for having an internal-only command?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly just follows the existing examples in the extension. For example, codeQL.copyRepoList and codeQL.autoDownloadRemoteQueryResults are both internal-only commands. I would suspect these were implemented as such so they can be easily called from anywhere in the extension.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for explaining 👍

variantAnalysisView.openView();
})
);
Expand Down
7 changes: 4 additions & 3 deletions extensions/ql-vscode/src/remote-queries/run-remote-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
showAndLogInformationMessage,
tryGetQueryMetadata,
pluralize,
tmpDir
tmpDir,
} from '../helpers';
import { Credentials } from '../authentication';
import * as cli from '../cli';
Expand Down Expand Up @@ -273,10 +273,11 @@ export async function runRemoteQuery(

const processedVariantAnalysis = processVariantAnalysis(variantAnalysisSubmission, variantAnalysisResponse);

// TODO: Remove once we have a proper notification
void showAndLogInformationMessage('Variant analysis submitted for processing');
void logger.log(`Variant analysis:\n${JSON.stringify(processedVariantAnalysis, null, 2)}`);

void showAndLogInformationMessage(`Variant analysis ${processedVariantAnalysis.query.name} submitted for processing`);

void commands.executeCommand('codeQL.openVariantAnalysisView', processedVariantAnalysis.id);
void commands.executeCommand('codeQL.monitorVariantAnalysis', processedVariantAnalysis);

return { variantAnalysis: processedVariantAnalysis };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { ViewColumn } from 'vscode';
import { ExtensionContext, ViewColumn } from 'vscode';
import { AbstractWebview, WebviewPanelConfig } from '../abstract-webview';
import { WebviewMessage } from '../interface-utils';
import { logger } from '../logging';

export class VariantAnalysisView extends AbstractWebview<WebviewMessage, WebviewMessage> {
public constructor(
ctx: ExtensionContext,
private readonly variantAnalysisId: number,
) {
super(ctx);
}

public openView() {
this.getPanel().reveal(undefined, true);
}

protected getPanelConfig(): WebviewPanelConfig {
return {
viewId: 'variantAnalysisView',
title: 'CodeQL Query Results',
title: `CodeQL Query Results for ${this.variantAnalysisId}`,
viewColumn: ViewColumn.Active,
preserveFocus: true,
view: 'variant-analysis'
Expand Down