Add new variant analysis view (#1506)
This commit is contained in:
@@ -313,6 +313,10 @@
|
|||||||
"command": "codeQL.exportVariantAnalysisResults",
|
"command": "codeQL.exportVariantAnalysisResults",
|
||||||
"title": "CodeQL: Export Variant Analysis Results"
|
"title": "CodeQL: Export Variant Analysis Results"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "codeQL.mockVariantAnalysisView",
|
||||||
|
"title": "CodeQL: Open Variant Analysis Mock View"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "codeQL.runQueries",
|
"command": "codeQL.runQueries",
|
||||||
"title": "CodeQL: Run Queries in Selected Files"
|
"title": "CodeQL: Run Queries in Selected Files"
|
||||||
@@ -893,6 +897,10 @@
|
|||||||
"command": "codeQL.exportVariantAnalysisResults",
|
"command": "codeQL.exportVariantAnalysisResults",
|
||||||
"when": "config.codeQL.canary"
|
"when": "config.codeQL.canary"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "codeQL.mockVariantAnalysisView",
|
||||||
|
"when": "config.codeQL.canary && config.codeQL.variantAnalysis.liveResults"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "codeQL.runQueries",
|
"command": "codeQL.runQueries",
|
||||||
"when": "false"
|
"when": "false"
|
||||||
|
|||||||
@@ -387,3 +387,13 @@ export function getActionBranch(): string {
|
|||||||
export function isIntegrationTestMode() {
|
export function isIntegrationTestMode() {
|
||||||
return process.env.INTEGRATION_TEST_MODE === 'true';
|
return process.env.INTEGRATION_TEST_MODE === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A flag indicating whether to enable the experimental "live results" feature
|
||||||
|
* for multi-repo variant analyses.
|
||||||
|
*/
|
||||||
|
const LIVE_RESULTS = new Setting('liveResults', REMOTE_QUERIES_SETTING);
|
||||||
|
|
||||||
|
export function isVariantAnalysisLiveResultsEnabled(): boolean {
|
||||||
|
return !!LIVE_RESULTS.getValue<boolean>();
|
||||||
|
}
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ import { EvalLogViewer } from './eval-log-viewer';
|
|||||||
import { SummaryLanguageSupport } from './log-insights/summary-language-support';
|
import { SummaryLanguageSupport } from './log-insights/summary-language-support';
|
||||||
import { JoinOrderScannerProvider } from './log-insights/join-order';
|
import { JoinOrderScannerProvider } from './log-insights/join-order';
|
||||||
import { LogScannerService } from './log-insights/log-scanner-service';
|
import { LogScannerService } from './log-insights/log-scanner-service';
|
||||||
|
import { VariantAnalysisInterfaceManager } from './remote-queries/variant-analysis-interface';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* extension.ts
|
* extension.ts
|
||||||
@@ -919,6 +920,13 @@ async function activateWithInstalledDistribution(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ctx.subscriptions.push(
|
||||||
|
commandRunner('codeQL.mockVariantAnalysisView', async () => {
|
||||||
|
const variantAnalysisView = new VariantAnalysisInterfaceManager(ctx);
|
||||||
|
variantAnalysisView.openView();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
ctx.subscriptions.push(
|
ctx.subscriptions.push(
|
||||||
commandRunner(
|
commandRunner(
|
||||||
'codeQL.openReferencedFile',
|
'codeQL.openReferencedFile',
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export function tryResolveLocation(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type WebviewView = 'results' | 'compare' | 'remote-queries';
|
export type WebviewView = 'results' | 'compare' | 'remote-queries' | 'variant-analysis';
|
||||||
|
|
||||||
export interface WebviewMessage {
|
export interface WebviewMessage {
|
||||||
t: string;
|
t: string;
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { ViewColumn } from 'vscode';
|
||||||
|
import { AbstractInterfaceManager, InterfacePanelConfig } from '../abstract-interface-manager';
|
||||||
|
import { WebviewMessage } from '../interface-utils';
|
||||||
|
import { logger } from '../logging';
|
||||||
|
|
||||||
|
export class VariantAnalysisInterfaceManager extends AbstractInterfaceManager<WebviewMessage, WebviewMessage> {
|
||||||
|
public openView() {
|
||||||
|
this.getPanel().reveal(undefined, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getPanelConfig(): InterfacePanelConfig {
|
||||||
|
return {
|
||||||
|
viewId: 'variantAnalysisView',
|
||||||
|
title: 'CodeQL Query Results',
|
||||||
|
viewColumn: ViewColumn.Active,
|
||||||
|
preserveFocus: true,
|
||||||
|
view: 'variant-analysis'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onPanelDispose(): void {
|
||||||
|
// Nothing to dispose currently.
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async onMessage(msg: WebviewMessage): Promise<void> {
|
||||||
|
void logger.log('Received message on variant analysis view: ' + msg.t);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
|
export function VariantAnalysis(): JSX.Element {
|
||||||
|
return <span>Hello!</span>;
|
||||||
|
}
|
||||||
13
extensions/ql-vscode/src/view/variant-analysis/index.tsx
Normal file
13
extensions/ql-vscode/src/view/variant-analysis/index.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { WebviewDefinition } from '../webview-interface';
|
||||||
|
import { VariantAnalysis } from './VariantAnalysis';
|
||||||
|
|
||||||
|
const definition: WebviewDefinition = {
|
||||||
|
component: <VariantAnalysis />,
|
||||||
|
|
||||||
|
// This is temporarily using the wrong message type.
|
||||||
|
// We will change it in the near future.
|
||||||
|
loadedMessage: 'remoteQueryLoaded'
|
||||||
|
};
|
||||||
|
|
||||||
|
export default definition;
|
||||||
Reference in New Issue
Block a user