From c5b91342d65806e0d0b09b54ec89e44ab0f82a38 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Sun, 28 Jun 2020 01:06:42 -0700 Subject: [PATCH] Remove extra dispose implementations --- .../src/utils/dependentRegistration.ts | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/extensions/typescript-language-features/src/utils/dependentRegistration.ts b/extensions/typescript-language-features/src/utils/dependentRegistration.ts index 434379f57e1..75dac667204 100644 --- a/extensions/typescript-language-features/src/utils/dependentRegistration.ts +++ b/extensions/typescript-language-features/src/utils/dependentRegistration.ts @@ -45,18 +45,14 @@ export class VersionDependentRegistration extends Disposable { register: () => vscode.Disposable, ) { super(); - this._registration = new ConditionalRegistration(register); + + this._registration = this._register(new ConditionalRegistration(register)); + + this._register(this.client.onTsServerStarted(() => { + this.update(this.client.apiVersion); + })); this.update(client.apiVersion); - - this.client.onTsServerStarted(() => { - this.update(this.client.apiVersion); - }, null, this._disposables); - } - - public dispose() { - super.dispose(); - this._registration.dispose(); } private update(api: API) { @@ -74,14 +70,11 @@ export class ConfigurationDependentRegistration extends Disposable { register: () => vscode.Disposable, ) { super(); - this._registration = new ConditionalRegistration(register); - this.update(); - vscode.workspace.onDidChangeConfiguration(this.update, this, this._disposables); - } + this._registration = this._register(new ConditionalRegistration(register)); - public dispose() { - super.dispose(); - this._registration.dispose(); + this._register(vscode.workspace.onDidChangeConfiguration(this.update, this)); + + this.update(); } private update() {