Skip to content

Commit 2ab4c1a

Browse files
committed
Extract shared components out of interface.ts
This is in preparation for creating a new webview, extract shared functionality to the webview-utils file
1 parent e38a34e commit 2ab4c1a

File tree

3 files changed

+352
-258
lines changed

3 files changed

+352
-258
lines changed

extensions/ql-vscode/src/extension.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
import * as helpers from './helpers';
2222
import { assertNever } from './helpers-pure';
2323
import { spawnIdeServer } from './ide-server';
24-
import { InterfaceManager, WebviewReveal } from './interface';
24+
import { InterfaceManager } from './interface';
25+
import { WebviewReveal } from './webview-utils';
2526
import { ideServerLogger, logger, queryServerLogger } from './logging';
2627
import { QueryHistoryManager } from './query-history';
2728
import { CompletedQuery } from './query-results';
@@ -30,6 +31,7 @@ import { displayQuickQuery } from './quick-query';
3031
import { compileAndRunQueryAgainstDatabase, tmpDirDisposal, UserCancellationException } from './run-queries';
3132
import { QLTestAdapterFactory } from './test-adapter';
3233
import { TestUIService } from './test-ui';
34+
import { CompareInterfaceManager } from './compare/compare-interface';
3335

3436
/**
3537
* extension.ts
@@ -303,14 +305,24 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
303305
const qhm = new QueryHistoryManager(
304306
ctx,
305307
queryHistoryConfigurationListener,
306-
async item => showResultsForCompletedQuery(item, WebviewReveal.Forced)
308+
async item => showResultsForCompletedQuery(item, WebviewReveal.Forced),
309+
async (from: CompletedQuery, to: CompletedQuery) => showResultsForComparison(from, to, WebviewReveal.Forced),
307310
);
308311
logger.log('Initializing results panel interface.');
309312
const intm = new InterfaceManager(ctx, dbm, cliServer, queryServerLogger);
310313
ctx.subscriptions.push(intm);
314+
315+
logger.log('Initializing compare panel interface.');
316+
const cmpm = new CompareInterfaceManager(ctx, dbm, cliServer, queryServerLogger);
317+
ctx.subscriptions.push(cmpm);
318+
311319
logger.log('Initializing source archive filesystem provider.');
312320
archiveFilesystemProvider.activate(ctx);
313321

322+
async function showResultsForComparison(from: CompletedQuery, to: CompletedQuery, forceReveal: WebviewReveal): Promise<void> {
323+
await cmpm.showResults(from, to, forceReveal);
324+
}
325+
314326
async function showResultsForCompletedQuery(query: CompletedQuery, forceReveal: WebviewReveal): Promise<void> {
315327
await intm.showResults(query, forceReveal, false);
316328
}

0 commit comments

Comments
 (0)