Skip to content

Commit c17370b

Browse files
committed
Avoids double lookup
1 parent 70ace6d commit c17370b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/views/viewBase.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export abstract class ViewBase<
270270
if (this.container.debugging || configuration.get('debug')) {
271271
function addDebuggingInfo(item: TreeItem, node: ViewNode, parent: ViewNode | undefined) {
272272
item.tooltip ??= new MarkdownString(
273-
item.label != null && typeof item.label !== 'string' ? item.label.label : (item.label ?? ''),
273+
item.label != null && typeof item.label !== 'string' ? item.label.label : item.label ?? '',
274274
);
275275

276276
if (typeof item.tooltip === 'string') {
@@ -510,9 +510,10 @@ export abstract class ViewBase<
510510

511511
const ensureGroupedHeaderNode = (children: ViewNode[]): ViewNode[] => {
512512
if (!children.length) return children;
513-
if (children[0] instanceof GroupedHeaderNode) return children.length === 1 ? [] : children;
514513

515514
const index = children.findIndex(n => n instanceof GroupedHeaderNode);
515+
if (index === 0) return children.length === 1 ? [] : children;
516+
516517
if (index === -1) {
517518
children.unshift(new GroupedHeaderNode(this as unknown as View, node));
518519
} else if (index > 0) {
@@ -565,8 +566,8 @@ export abstract class ViewBase<
565566
(this.grouped
566567
? `${this.name.toLocaleLowerCase()}${count != null ? ` (${count})` : ''}`
567568
: count != null
568-
? `(${count})`
569-
: '') || undefined
569+
? `(${count})`
570+
: '') || undefined
570571
);
571572
}
572573

0 commit comments

Comments
 (0)