Skip to content

Commit 3ccc7a9

Browse files
committed
async data source can be sync
1 parent 75d5bc4 commit 3ccc7a9

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/vs/base/browser/ui/tree/asyncDataTree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ export class AsyncDataTree<T extends NonNullable<any>, TFilterData = void> imple
468468
this._onDidChangeNodeState.fire(node);
469469
}, _ => null);
470470

471-
return this.dataSource.getChildren(node.element)
471+
return Promise.resolve(this.dataSource.getChildren(node.element))
472472
.then(children => {
473473
slowTimeout.cancel();
474474
node.state = AsyncDataTreeNodeState.Loaded;

src/vs/base/browser/ui/tree/tree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export interface ITreeNavigator<T> {
147147

148148
export interface IAsyncDataSource<T extends NonNullable<any>> {
149149
hasChildren(element: T | null): boolean;
150-
getChildren(element: T | null): Promise<T[]>;
150+
getChildren(element: T | null): T[] | Promise<T[]>;
151151
}
152152

153153
/**

0 commit comments

Comments
 (0)