diff --git a/packages/plugin-ext/src/plugin/tree/tree-views.ts b/packages/plugin-ext/src/plugin/tree/tree-views.ts index 519cb7cfe6d21..611baeaaac631 100644 --- a/packages/plugin-ext/src/plugin/tree/tree-views.ts +++ b/packages/plugin-ext/src/plugin/tree/tree-views.ts @@ -320,8 +320,7 @@ class TreeViewExtImpl implements Disposable { // ask data provider for children for cached element const result = await this.treeDataProvider.getChildren(parent); if (result) { - const treeItems: TreeViewItem[] = []; - const promises = result.map(async (value, index) => { + const treeItemPromises = result.map(async (value, index) => { // Ask data provider for a tree item for the value // Data provider must return theia.TreeItem @@ -374,11 +373,10 @@ class TreeViewExtImpl implements Disposable { command: this.commandsConverter.toSafeCommand(treeItem.command, toDisposeElement) } as TreeViewItem; - treeItems.push(treeViewItem); + return treeViewItem; }); - await Promise.all(promises); - return treeItems; + return Promise.all(treeItemPromises); } else { return undefined; }