Skip to content

Commit a550394

Browse files
committed
1 parent d1a9e7f commit a550394

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

src/vs/workbench/parts/debug/browser/loadedScriptsView.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,24 @@ class BaseTreeItem {
7878
// skips intermediate single-child nodes
7979
getParent(): BaseTreeItem {
8080
if (this._parent) {
81-
const child = this._parent.oneChild();
82-
if (child) {
81+
if (this._parent.isSkipped()) {
8382
return this._parent.getParent();
8483
}
8584
return this._parent;
8685
}
8786
return undefined;
8887
}
8988

89+
isSkipped(): boolean {
90+
if (this._parent) {
91+
if (this._parent.oneChild()) {
92+
return true; // skipped if I'm the only child of my parents
93+
}
94+
return false;
95+
}
96+
return true; // roots are never skipped
97+
}
98+
9099
// skips intermediate single-child nodes
91100
hasChildren(): boolean {
92101
const child = this.oneChild();
@@ -119,10 +128,11 @@ class BaseTreeItem {
119128
// skips intermediate single-child nodes
120129
getHoverLabel(): string {
121130
let label = this.getLabel(false);
122-
if (this._parent) {
123-
const parentLabel = this._parent.getHoverLabel();
124-
if (parentLabel) {
125-
return `${parentLabel}/${label}`;
131+
const parent = this.getParent();
132+
if (parent) {
133+
const hover = parent.getHoverLabel();
134+
if (hover) {
135+
return `${hover}/${label}`;
126136
}
127137
}
128138
return label;

0 commit comments

Comments
 (0)