From 0bfce9a5f61ab1d8be46f6444d89eba0700baa13 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 15 Aug 2022 02:27:53 -0400 Subject: [PATCH] Fixes duplicated context on view debug tooltips --- src/views/viewBase.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/views/viewBase.ts b/src/views/viewBase.ts index 62b9f0e..fe1a08f 100644 --- a/src/views/viewBase.ts +++ b/src/views/viewBase.ts @@ -134,24 +134,22 @@ export abstract class ViewBase< this.getTreeItem = async function (this: ViewBase, node: ViewNode) { const item = await getTreeItemFn.apply(this, [node]); - const parent = node.getParent(); - - if (node.resolveTreeItem != null) { - if (item.tooltip != null) { - addDebuggingInfo(item, node, parent); - } + if (node.resolveTreeItem == null) { + addDebuggingInfo(item, node, node.getParent()); + } - const resolveTreeItemFn = node.resolveTreeItem; - node.resolveTreeItem = async function (this: ViewBase, item: TreeItem) { - const resolvedItem = await resolveTreeItemFn.apply(this, [item]); + return item; + }; - addDebuggingInfo(resolvedItem, node, parent); + const resolveTreeItemFn = this.resolveTreeItem; + this.resolveTreeItem = async function ( + this: ViewBase, + item: TreeItem, + node: ViewNode, + ) { + item = await resolveTreeItemFn.apply(this, [item, node]); - return resolvedItem; - }; - } else { - addDebuggingInfo(item, node, parent); - } + addDebuggingInfo(item, node, node.getParent()); return item; }; @@ -556,7 +554,7 @@ export abstract class ViewBase< context?: Record, ) { if (previousNode != null) { - (await this.reveal(previousNode, { select: true })); + await this.reveal(previousNode, { select: true }); } await node.loadMore(limit, context);