From ba9a40bf186f69c689f2c55f19f282e12a1a7177 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 21 Dec 2020 03:17:23 -0500 Subject: [PATCH] Fixes debug view tooltips --- src/views/viewBase.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/views/viewBase.ts b/src/views/viewBase.ts index 95cefd4..57acc45 100644 --- a/src/views/viewBase.ts +++ b/src/views/viewBase.ts @@ -116,21 +116,24 @@ export abstract class ViewBase< const item = await getTreeItem.apply(this, [node]); const parent = node.getParent(); - let tooltip = item.tooltip; - if (tooltip == null) { - item.tooltip = tooltip = new MarkdownString( + if (item.tooltip == null) { + item.tooltip = new MarkdownString( item.label != null && typeof item.label !== 'string' ? item.label.label : item.label ?? '', ); - } else if (typeof tooltip === 'string') { - item.tooltip = tooltip = new MarkdownString(tooltip); } - tooltip.appendMarkdown( - `\n\n---\n\ncontext: \`${item.contextValue}\`\n\nnode: \`${node.toString()}\`${ - parent != null ? `\n\nparent: \`${parent.toString()}\`` : '' - }`, - ); + if (typeof item.tooltip === 'string') { + item.tooltip = `${item.tooltip}\n\n---\ncontext: ${item.contextValue}\nnode: ${node.toString()}${ + parent != null ? `\nparent: ${parent.toString()}` : '' + }`; + } else { + item.tooltip.appendMarkdown( + `\n\n---\n\ncontext: \`${item.contextValue}\`\n\nnode: \`${node.toString()}\`${ + parent != null ? `\n\nparent: \`${parent.toString()}\`` : '' + }`, + ); + } return item; };