TypeFox/vscode-ws-jsonrpc

[quality] Align `DisposableCollection` with Theia?

Opened this issue · 1 comments

The DisposableCollection is cool and convenient to use, however, what we have fixed in Theia never got back to here. Time to update or publish the DisposableCollection to npmjs and we do not have to copy-paste the code over and over.

See the diffs:

protected readonly disposables: Disposable[] = [];
dispose(): void {
while (this.disposables.length !== 0) {
this.disposables.pop()!.dispose();
}
}
push(disposable: Disposable): Disposable {
const disposables = this.disposables;
disposables.push(disposable);
return {
dispose(): void {
const index = disposables.indexOf(disposable);
if (index !== -1) {
disposables.splice(index, 1);
}
}
}
}
}

https://github.com/eclipse-theia/theia/blob/c4b4d3995ba81a80e36cd62d290dce2b23c8fd82/packages/core/src/common/disposable.ts#L38-L102

I think we should get rid of this package and merge it in Theia, something like @theia/jsonrpc. Also see eclipse-theia/theia#1783