about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2022-10-17 16:01:39 +0200
committerLukas Wirth <lukastw97@gmail.com>2022-10-17 16:01:39 +0200
commitd63c44e650f9a6ce2fc5f713b4688f3e9e2d9a8d (patch)
tree9657b3a581c29330ef8700d33c272cab5d10e3ad
parent7b5c943129ca285ec2c386b8608f1410ee258f07 (diff)
downloadrust-d63c44e650f9a6ce2fc5f713b4688f3e9e2d9a8d.tar.gz
rust-d63c44e650f9a6ce2fc5f713b4688f3e9e2d9a8d.zip
Cleanup output channels
-rw-r--r--editors/code/src/ctx.ts24
1 files 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);
     }