Skip to content

Commit 0796893

Browse files
committed
Logging: More chatty logging during extension initialization.
Mainly intentded to make it easier to debug the cause of command-palette commands being undefined.
1 parent 6fdfade commit 0796893

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

extensions/ql-vscode/src/databases-ui.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export class DatabaseUI extends DisposableObject {
174174
this.treeDataProvider = this.push(new DatabaseTreeDataProvider(ctx, databaseManager));
175175
this.push(window.createTreeView('codeQLDatabases', { treeDataProvider: this.treeDataProvider }));
176176

177+
logger.log('Registering database panel commands.');
177178
ctx.subscriptions.push(commands.registerCommand('codeQL.chooseDatabaseFolder', this.handleChooseDatabaseFolder));
178179
ctx.subscriptions.push(commands.registerCommand('codeQL.chooseDatabaseArchive', this.handleChooseDatabaseArchive));
179180
ctx.subscriptions.push(commands.registerCommand('codeQL.chooseDatabaseInternet', this.handleChooseDatabaseInternet));

extensions/ql-vscode/src/extension.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,31 +251,39 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
251251
// of activation.
252252
errorStubs.forEach(stub => stub.dispose());
253253

254+
logger.log('Initializing configuration listener...');
254255
const qlConfigurationListener = await QueryServerConfigListener.createQueryServerConfigListener(distributionManager);
255256
ctx.subscriptions.push(qlConfigurationListener);
256257

258+
logger.log('Initializing CodeQL cli server...');
257259
const cliServer = new CodeQLCliServer(distributionManager, logger);
258260
ctx.subscriptions.push(cliServer);
259261

262+
logger.log('Initializing query server client.');
260263
const qs = new qsClient.QueryServerClient(qlConfigurationListener, cliServer, {
261264
logger: queryServerLogger,
262265
}, task => Window.withProgress({ title: 'CodeQL query server', location: ProgressLocation.Window }, task));
263266
ctx.subscriptions.push(qs);
264267
await qs.startQueryServer();
265268

269+
logger.log('Initializing database manager.');
266270
const dbm = new DatabaseManager(ctx, qlConfigurationListener, logger);
267271
ctx.subscriptions.push(dbm);
272+
logger.log('Initializing database panel.');
268273
const databaseUI = new DatabaseUI(ctx, cliServer, dbm, qs, getContextStoragePath(ctx));
269274
ctx.subscriptions.push(databaseUI);
270275

276+
logger.log('Initializing query history manager.');
271277
const queryHistoryConfigurationListener = new QueryHistoryConfigListener();
272278
const qhm = new QueryHistoryManager(
273279
ctx,
274280
queryHistoryConfigurationListener,
275281
async item => showResultsForCompletedQuery(item, WebviewReveal.Forced)
276282
);
283+
logger.log('Initializing results panel interface.');
277284
const intm = new InterfaceManager(ctx, dbm, cliServer, queryServerLogger);
278285
ctx.subscriptions.push(intm);
286+
logger.log('Initializing source archive filesystem provider.');
279287
archiveFilesystemProvider.activate(ctx);
280288

281289
async function showResultsForCompletedQuery(query: CompletedQuery, forceReveal: WebviewReveal): Promise<void> {
@@ -306,6 +314,7 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
306314

307315
ctx.subscriptions.push(tmpDirDisposal);
308316

317+
logger.log('Initializing CodeQL language server.');
309318
const client = new LanguageClient('CodeQL Language Server', () => spawnIdeServer(qlConfigurationListener), {
310319
documentSelector: [
311320
{ language: 'ql', scheme: 'file' },
@@ -318,6 +327,7 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
318327
outputChannel: ideServerLogger.outputChannel
319328
}, true);
320329

330+
logger.log('Initializing QLTest interface.');
321331
const testExplorerExtension = extensions.getExtension<TestHub>(testExplorerExtensionId);
322332
if (testExplorerExtension) {
323333
const testHub = testExplorerExtension.exports;
@@ -328,6 +338,7 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
328338
ctx.subscriptions.push(testUIService);
329339
}
330340

341+
logger.log('Registering top-level command palette commands.');
331342
ctx.subscriptions.push(commands.registerCommand('codeQL.runQuery', async (uri: Uri | undefined) => await compileAndRunQuery(false, uri)));
332343
ctx.subscriptions.push(commands.registerCommand('codeQL.quickEval', async (uri: Uri | undefined) => await compileAndRunQuery(true, uri)));
333344
ctx.subscriptions.push(commands.registerCommand('codeQL.quickQuery', async () => displayQuickQuery(ctx, cliServer, databaseUI)));
@@ -337,9 +348,11 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
337348
}));
338349
ctx.subscriptions.push(commands.registerCommand('codeQL.downloadDatabase', () => promptImportInternetDatabase(dbm, getContextStoragePath(ctx))));
339350

351+
logger.log('Starting language server.');
340352
ctx.subscriptions.push(client.start());
341353

342354
if (EXPERIMENTAL_FEATURES_SETTING.getValue()) {
355+
logger.log('[EXPERIMENTAL] Registering jump-to-definition handlers.');
343356
languages.registerDefinitionProvider(
344357
{ scheme: archiveFilesystemProvider.zipArchiveScheme },
345358
new TemplateQueryDefinitionProvider(cliServer, qs, dbm)
@@ -349,6 +362,8 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
349362
new TemplateQueryReferenceProvider(cliServer, qs, dbm)
350363
);
351364
}
365+
366+
logger.log('Successfully finished extension initialization.');
352367
}
353368

354369
function getContextStoragePath(ctx: ExtensionContext) {

extensions/ql-vscode/src/interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export class InterfaceManager extends DisposableObject {
138138
this.handleSelectionChange.bind(this)
139139
)
140140
);
141+
logger.log('Registering path-step navigation commands.');
141142
this.push(
142143
vscode.commands.registerCommand(
143144
"codeQLQueryResults.nextPathStep",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ export class QueryHistoryManager {
290290
this.updateTreeViewSelectionIfVisible();
291291
}
292292
});
293+
logger.log('Registering query history panel commands.');
293294
ctx.subscriptions.push(vscode.commands.registerCommand('codeQLQueryHistory.openQuery', this.handleOpenQuery));
294295
ctx.subscriptions.push(vscode.commands.registerCommand('codeQLQueryHistory.removeHistoryItem', this.handleRemoveHistoryItem.bind(this)));
295296
ctx.subscriptions.push(vscode.commands.registerCommand('codeQLQueryHistory.setLabel', this.handleSetLabel.bind(this)));

extensions/ql-vscode/src/test-ui.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { TestTreeNode } from './test-tree-node';
55
import { DisposableObject, UIService } from 'semmle-vscode-utils';
66
import { TestHub, TestController, TestAdapter, TestRunStartedEvent, TestRunFinishedEvent, TestEvent, TestSuiteEvent } from 'vscode-test-adapter-api';
77
import { QLTestAdapter, getExpectedFile, getActualFile } from './test-adapter';
8+
import { logger } from './logging';
89

910
type VSCodeTestEvent = TestRunStartedEvent | TestRunFinishedEvent | TestSuiteEvent | TestEvent;
1011

@@ -32,6 +33,7 @@ export class TestUIService extends UIService implements TestController {
3233
constructor(private readonly testHub: TestHub) {
3334
super();
3435

36+
logger.log('Registering CodeQL test panel commands.');
3537
this.registerCommand('codeQLTests.showOutputDifferences', this.showOutputDifferences);
3638
this.registerCommand('codeQLTests.acceptOutput', this.acceptOutput);
3739

0 commit comments

Comments
 (0)