提交 f6f4f80c 编写于 作者: S Sandeep Somavarapu

Fix #63606

上级 04cbc78e
......@@ -365,9 +365,6 @@ export class CustomTreeView extends Disposable implements ITreeView {
}
show(container: HTMLElement): void {
if (!this.tree) {
this.createTree();
}
DOM.append(container, this.domNode);
}
......@@ -390,6 +387,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
this._register(this.tree.onDidExpandItem(e => this._onDidExpandItem.fire(e.item.getElement())));
this._register(this.tree.onDidCollapseItem(e => this._onDidCollapseItem.fire(e.item.getElement())));
this._register(this.tree.onDidChangeSelection(e => this._onDidChangeSelection.fire(e.selection)));
this.tree.setInput(this.root);
}
private updateMessage(): void {
......@@ -468,26 +466,36 @@ export class CustomTreeView extends Disposable implements ITreeView {
}
expand(itemOrItems: ITreeItem | ITreeItem[]): Thenable<void> {
itemOrItems = Array.isArray(itemOrItems) ? itemOrItems : [itemOrItems];
return this.tree.expandAll(itemOrItems);
if (this.tree) {
itemOrItems = Array.isArray(itemOrItems) ? itemOrItems : [itemOrItems];
return this.tree.expandAll(itemOrItems);
}
return Promise.arguments(null);
}
setSelection(items: ITreeItem[]): void {
this.tree.setSelection(items, { source: 'api' });
if (this.tree) {
this.tree.setSelection(items, { source: 'api' });
}
}
setFocus(item: ITreeItem): void {
this.focus();
this.tree.setFocus(item);
if (this.tree) {
this.focus();
this.tree.setFocus(item);
}
}
reveal(item: ITreeItem): Thenable<void> {
return this.tree.reveal(item);
if (this.tree) {
return this.tree.reveal(item);
}
return Promise.arguments(null);
}
private activate() {
if (!this.activated) {
this.tree.setInput(this.root);
this.createTree();
this.progressService.withProgress({ location: this.container.id }, () => this.extensionService.activateByEvent(`onView:${this.id}`))
.then(() => timeout(2000))
.then(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册