mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 14:33:29 +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(
|
this.traceOutputChannel = vscode.window.createOutputChannel(
|
||||||
"Rust Analyzer Language Server Trace"
|
"Rust Analyzer Language Server Trace"
|
||||||
);
|
);
|
||||||
|
this.pushExtCleanup(this.traceOutputChannel);
|
||||||
}
|
}
|
||||||
if (!this.outputChannel) {
|
if (!this.outputChannel) {
|
||||||
this.outputChannel = vscode.window.createOutputChannel("Rust Analyzer Language Server");
|
this.outputChannel = vscode.window.createOutputChannel("Rust Analyzer Language Server");
|
||||||
|
this.pushExtCleanup(this.outputChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.client) {
|
if (!this.client) {
|
||||||
|
@ -139,25 +141,10 @@ export class Ctx {
|
||||||
return editor && isRustEditor(editor) ? editor : undefined;
|
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 {
|
get extensionPath(): string {
|
||||||
return this.extCtx.extensionPath;
|
return this.extCtx.extensionPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
get globalState(): vscode.Memento {
|
|
||||||
return this.extCtx.globalState;
|
|
||||||
}
|
|
||||||
|
|
||||||
get subscriptions(): Disposable[] {
|
get subscriptions(): Disposable[] {
|
||||||
return this.extCtx.subscriptions;
|
return this.extCtx.subscriptions;
|
||||||
}
|
}
|
||||||
|
@ -201,6 +188,13 @@ export class Ctx {
|
||||||
statusBar.text = `${icon}rust-analyzer`;
|
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) {
|
pushExtCleanup(d: Disposable) {
|
||||||
this.extCtx.subscriptions.push(d);
|
this.extCtx.subscriptions.push(d);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue