From d63c44e650f9a6ce2fc5f713b4688f3e9e2d9a8d Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 17 Oct 2022 16:01:39 +0200 Subject: [PATCH] Cleanup output channels --- editors/code/src/ctx.ts | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 2080db7a2c1..e94d4365c37 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -62,9 +62,11 @@ export class Ctx { this.traceOutputChannel = vscode.window.createOutputChannel( "Rust Analyzer Language Server Trace" ); + this.pushExtCleanup(this.traceOutputChannel); } if (!this.outputChannel) { this.outputChannel = vscode.window.createOutputChannel("Rust Analyzer Language Server"); + this.pushExtCleanup(this.outputChannel); } if (!this.client) { @@ -139,25 +141,10 @@ export class Ctx { return editor && isRustEditor(editor) ? editor : undefined; } - get visibleRustEditors(): RustEditor[] { - return vscode.window.visibleTextEditors.filter(isRustEditor); - } - - registerCommand(name: string, factory: (ctx: Ctx) => Cmd) { - const fullName = `rust-analyzer.${name}`; - const cmd = factory(this); - const d = vscode.commands.registerCommand(fullName, cmd); - this.pushExtCleanup(d); - } - get extensionPath(): string { return this.extCtx.extensionPath; } - get globalState(): vscode.Memento { - return this.extCtx.globalState; - } - get subscriptions(): Disposable[] { return this.extCtx.subscriptions; } @@ -201,6 +188,13 @@ export class Ctx { statusBar.text = `${icon}rust-analyzer`; } + registerCommand(name: string, factory: (ctx: Ctx) => Cmd) { + const fullName = `rust-analyzer.${name}`; + const cmd = factory(this); + const d = vscode.commands.registerCommand(fullName, cmd); + this.pushExtCleanup(d); + } + pushExtCleanup(d: Disposable) { this.extCtx.subscriptions.push(d); }