mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-14 17:07:26 +00:00
Cleanup output channels
This commit is contained in:
parent
7b5c943129
commit
d63c44e650
1 changed files with 9 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue