Add Symbol.iterator functions for vscode.d.ts collection types (#151806)

* Add entries functions for vscode.d.ts collection types

Fixes #151802

* Spelling

* Enable lib.iterable in vscode.d.ts

* Switch to use `Symbol.iterator` instead of `entries`

* Use extends Iterable in more places

* Fixing testItemCollection types

* Fixing exthost testing
This commit is contained in:
Matt Bierner
2022-06-15 09:29:50 -07:00
committed by GitHub
parent f17b33faf2
commit 001d52cf6b
8 changed files with 48 additions and 22 deletions

View File

@@ -36,8 +36,8 @@ const assertTreesEqual = (a: TestItemImpl | undefined, b: TestItemImpl | undefin
assert.deepStrictEqual(simplify(a), simplify(b));
const aChildren = [...a.children].map(c => c.id).sort();
const bChildren = [...b.children].map(c => c.id).sort();
const aChildren = [...a.children].map(([_, c]) => c.id).sort();
const bChildren = [...b.children].map(([_, c]) => c.id).sort();
assert.strictEqual(aChildren.length, bChildren.length, `expected ${a.label}.children.length == ${b.label}.children.length`);
aChildren.forEach(key => assertTreesEqual(a.children.get(key) as TestItemImpl, b.children.get(key) as TestItemImpl));
};
@@ -242,7 +242,7 @@ suite('ExtHost Testing', () => {
const oldA = single.root.children.get('id-a') as TestItemImpl;
const newA = new TestItemImpl('ctrlId', 'id-a', 'Hello world', undefined);
newA.children.replace([...oldA.children]);
newA.children.replace([...oldA.children].map(([_, item]) => item));
single.root.children.replace([
newA,
new TestItemImpl('ctrlId', 'id-b', single.root.children.get('id-b')!.label, undefined),
@@ -334,7 +334,7 @@ suite('ExtHost Testing', () => {
},
]);
assert.deepStrictEqual([...single.root.children], [single.root.children.get('id-a')]);
assert.deepStrictEqual([...single.root.children].map(([_, item]) => item), [single.root.children.get('id-a')]);
assert.deepStrictEqual(b.parent, a);
});
});