diff --git a/vscode-dotty/src/tracer.ts b/vscode-dotty/src/tracer.ts index 1a4841001d27..2d13ca6c788a 100644 --- a/vscode-dotty/src/tracer.ts +++ b/vscode-dotty/src/tracer.ts @@ -75,15 +75,17 @@ export class Tracer { run(): vscode.OutputChannel | undefined { const consentCommandDisposable = vscode.commands.registerCommand(consentCommandName, () => this.askForTracingConsent()) - if (this.isTracingEnabled && this.tracingConsent.get() === 'no-answer') this.askForTracingConsent() - this.initializeAsyncWorkspaceDump() - - const lspOutputChannel = this.createLspOutputChannel() - const statusBarItem = this.createStatusBarItem() - for (const disposable of [consentCommandDisposable, lspOutputChannel, statusBarItem]) { - if (disposable) this.ctx.extensionContext.subscriptions.push(disposable) + if (this.isTracingEnabled) { + if (this.tracingConsent.get() === 'no-answer') this.askForTracingConsent() + this.initializeAsyncWorkspaceDump() + + const lspOutputChannel = this.createLspOutputChannel() + const statusBarItem = this.createStatusBarItem() + for (const disposable of [consentCommandDisposable, lspOutputChannel, statusBarItem]) { + if (disposable) this.ctx.extensionContext.subscriptions.push(disposable) + } + return lspOutputChannel } - return lspOutputChannel } private askForTracingConsent(): void {