提交 8fbfcb1c 编写于 作者: S Sandeep Somavarapu

Fix #50143

上级 ab7826b8
......@@ -362,7 +362,7 @@ class ExtHostTreeView<T> extends Disposable {
return item;
}
private createHandle(element: T, { id, label, resourceUri }: vscode.TreeItem, parent: TreeNode, first?: boolean): TreeItemHandle {
private createHandle(element: T, { id, label, resourceUri }: vscode.TreeItem, parent: TreeNode, returnFirst?: boolean): TreeItemHandle {
if (id) {
return `${ExtHostTreeView.ID_HANDLE_PREFIX}/${id}`;
}
......@@ -373,14 +373,20 @@ class ExtHostTreeView<T> extends Disposable {
const existingHandle = this.nodes.has(element) ? this.nodes.get(element).item.handle : void 0;
const childrenNodes = (this.getChildrenNodes(parent) || []);
for (let counter = 0; counter <= childrenNodes.length; counter++) {
const handle = `${prefix}/${counter}:${elementId}`;
if (first || !this.elements.has(handle) || existingHandle === handle) {
return handle;
let handle: TreeItemHandle;
let counter = 0;
do {
handle = `${prefix}/${counter}:${elementId}`;
if (returnFirst || !this.elements.has(handle) || existingHandle === handle) {
// Return first if asked for or
// Return if handle does not exist or
// Return if handle is being reused
break;
}
}
counter++;
} while (counter <= childrenNodes.length);
throw new Error('This should not be reached');
return handle;
}
private getLightIconPath(extensionTreeItem: vscode.TreeItem): string {
......@@ -457,7 +463,7 @@ class ExtHostTreeView<T> extends Disposable {
}
}
}
node.children = [];
node.children = void 0;
} else {
this.clearAll();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册