提交 a550394f 编写于 作者: A Andre Weinand

fix #57545

上级 d1a9e7f2
......@@ -78,8 +78,7 @@ class BaseTreeItem {
// skips intermediate single-child nodes
getParent(): BaseTreeItem {
if (this._parent) {
const child = this._parent.oneChild();
if (child) {
if (this._parent.isSkipped()) {
return this._parent.getParent();
}
return this._parent;
......@@ -87,6 +86,16 @@ class BaseTreeItem {
return undefined;
}
isSkipped(): boolean {
if (this._parent) {
if (this._parent.oneChild()) {
return true; // skipped if I'm the only child of my parents
}
return false;
}
return true; // roots are never skipped
}
// skips intermediate single-child nodes
hasChildren(): boolean {
const child = this.oneChild();
......@@ -119,10 +128,11 @@ class BaseTreeItem {
// skips intermediate single-child nodes
getHoverLabel(): string {
let label = this.getLabel(false);
if (this._parent) {
const parentLabel = this._parent.getHoverLabel();
if (parentLabel) {
return `${parentLabel}/${label}`;
const parent = this.getParent();
if (parent) {
const hover = parent.getHoverLabel();
if (hover) {
return `${hover}/${label}`;
}
}
return label;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册