未验证 提交 6615b4ea 编写于 作者: B Barbara Valdez 提交者: GitHub

Modify treeDataChange event (#125214)

上级 8e7a2a8e
......@@ -919,6 +919,15 @@ declare module 'vscode' {
//#region Custom Tree View Drag and Drop https://github.com/microsoft/vscode/issues/32592
export interface TreeViewOptions<T> {
/**
* An optional event to signal that elements or the root have changed.
* This will trigger the view to update the changed element/root and its children recursively (if shown).
* To signal that root has changed, do not pass any argument or pass `undefined` or `null`.
*/
onDidChangeTreeData?: Event<T | T[] | undefined | null | void>;
/**
* An optional interface to implement drag and drop in the tree view.
*/
dragAndDropController?: DragAndDropController<T>;
}
......
......@@ -189,7 +189,7 @@ export class ExtHostTreeViews implements ExtHostTreeViewsShape {
}
type Root = null | undefined | void;
type TreeData<T> = { message: boolean, element: T | Root | false };
type TreeData<T> = { message: boolean, element: T | T[] | Root | false };
interface TreeNode extends IDisposable {
item: ITreeItem;
......@@ -269,8 +269,12 @@ class ExtHostTreeView<T> extends Disposable {
refreshingPromise = new Promise(c => promiseCallback = c);
this.refreshPromise = this.refreshPromise.then(() => refreshingPromise!);
}
if (Array.isArray(current.element)) {
result.elements.push(...current.element);
} else {
result.elements.push(current.element);
}
}
if (current.message) {
result.message = true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册