import { printTree } from 'tree-dump/lib/printTree';
export class Extensions {
    ext = {};
    register(extension) {
        this.ext[extension.id] = extension;
    }
    get(id) {
        return this.ext[id];
    }
    size() {
        return Object.keys(this.ext).length;
    }
    clone() {
        const clone = new Extensions();
        for (const ext of Object.values(this.ext))
            clone.register(ext);
        return clone;
    }
    toString(tab = '') {
        const keys = Object.keys(this.ext)
            .map((k) => +k)
            .sort();
        return ('extensions' +
            printTree(tab, keys.map((k) => (tab) => `${k}: ${this.ext[k].name}`)));
    }
}
//# sourceMappingURL=Extensions.js.map