remove refreshNode method (#14552)

* remove refreshNode method

* fix issue with finding required node handles
This commit is contained in:
Alan Ren
2021-03-04 15:15:15 -08:00
committed by GitHub
parent 9cfba8e8e0
commit 99d46917e8
2 changed files with 4 additions and 19 deletions

View File

@@ -502,12 +502,12 @@ export class ExtHostTreeView<T> extends Disposable {
// {{SQL CARBON EDIT}}
protected getHandlesToRefresh(elements: T[]): TreeItemHandle[] {
const elementsToUpdate = new Set<TreeItemHandle>();
for (const element of elements) {
const elementNode = this.nodes.get(element);
const elementNodes = elements.map(element => this.nodes.get(element));
for (const elementNode of elementNodes) {
if (elementNode && !elementsToUpdate.has(elementNode.item.handle)) {
// check if an ancestor of extElement is already in the elements to update list
// check if an ancestor of extElement is already in the elements list
let currentNode: TreeNode | undefined = elementNode;
while (currentNode && currentNode.parent && !elementsToUpdate.has(currentNode.parent.item.handle)) {
while (currentNode && currentNode.parent && elementNodes.findIndex(node => currentNode && currentNode.parent && node && node.item.handle === currentNode.parent.item.handle) === -1) {
const parentElement: T | undefined = this.elements.get(currentNode.parent.item.handle);
currentNode = parentElement ? this.nodes.get(parentElement) : undefined;
}