Skip to content

Commit d63c44e

Browse files
committed
Cleanup output channels
1 parent 7b5c943 commit d63c44e

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

editors/code/src/ctx.ts

+9-15
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ export class Ctx {
6262
this.traceOutputChannel = vscode.window.createOutputChannel(
6363
"Rust Analyzer Language Server Trace"
6464
);
65+
this.pushExtCleanup(this.traceOutputChannel);
6566
}
6667
if (!this.outputChannel) {
6768
this.outputChannel = vscode.window.createOutputChannel("Rust Analyzer Language Server");
69+
this.pushExtCleanup(this.outputChannel);
6870
}
6971

7072
if (!this.client) {
@@ -139,25 +141,10 @@ export class Ctx {
139141
return editor && isRustEditor(editor) ? editor : undefined;
140142
}
141143

142-
get visibleRustEditors(): RustEditor[] {
143-
return vscode.window.visibleTextEditors.filter(isRustEditor);
144-
}
145-
146-
registerCommand(name: string, factory: (ctx: Ctx) => Cmd) {
147-
const fullName = `rust-analyzer.${name}`;
148-
const cmd = factory(this);
149-
const d = vscode.commands.registerCommand(fullName, cmd);
150-
this.pushExtCleanup(d);
151-
}
152-
153144
get extensionPath(): string {
154145
return this.extCtx.extensionPath;
155146
}
156147

157-
get globalState(): vscode.Memento {
158-
return this.extCtx.globalState;
159-
}
160-
161148
get subscriptions(): Disposable[] {
162149
return this.extCtx.subscriptions;
163150
}
@@ -201,6 +188,13 @@ export class Ctx {
201188
statusBar.text = `${icon}rust-analyzer`;
202189
}
203190

191+
registerCommand(name: string, factory: (ctx: Ctx) => Cmd) {
192+
const fullName = `rust-analyzer.${name}`;
193+
const cmd = factory(this);
194+
const d = vscode.commands.registerCommand(fullName, cmd);
195+
this.pushExtCleanup(d);
196+
}
197+
204198
pushExtCleanup(d: Disposable) {
205199
this.extCtx.subscriptions.push(d);
206200
}

0 commit comments

Comments
 (0)