mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
async loading children
This commit is contained in:
@@ -264,6 +264,7 @@ export abstract class ExtHostEditorsShape {
|
||||
|
||||
export abstract class ExtHostExplorersShape {
|
||||
$provideTreeContent(treeContentProviderId: string): TPromise<string> { throw ni(); };
|
||||
$resolveChildren(treeContentProviderId: string, node: vscode.ITreeNode): TPromise<string> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class ExtHostExtensionServiceShape {
|
||||
|
||||
@@ -46,4 +46,15 @@ export class ExtHostExplorers extends ExtHostExplorersShape {
|
||||
return JSON.stringify(treeContent);
|
||||
}));
|
||||
}
|
||||
|
||||
$resolveChildren(treeContentProviderId: string, node: vscode.ITreeNode): TPromise<string> {
|
||||
const provider = this._treeContentProviders[treeContentProviderId];
|
||||
if (!provider) {
|
||||
throw new Error(`no TreeContentProvider registered with id '${treeContentProviderId}'`);
|
||||
}
|
||||
|
||||
return TPromise.wrap(provider.resolveChildren(node).then(children => {
|
||||
return JSON.stringify(children);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,11 @@ export class MainThreadExplorers extends MainThreadExplorersShape {
|
||||
return this._proxy.$provideTreeContent(providerId).then(jsonTree => {
|
||||
return <ITreeNode>JSON.parse(jsonTree);
|
||||
})
|
||||
},
|
||||
resolveChildren: (node: ITreeNode): TPromise<ITreeNode[]> => {
|
||||
return this._proxy.$resolveChildren(providerId, node).then(jsonChildren => {
|
||||
return <ITreeNode[]>JSON.parse(jsonChildren);
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user