Skip to content

Commit

Permalink
节点展开和折叠事件
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Jun 4, 2024
1 parent af8a503 commit ccc5235
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/console/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,14 @@ export class TreeViewManager extends vscode.Disposable {
showCollapseAll: true,
});
this.view.onDidExpandElement(e => {
this.notifyChangeTreeNodeExpanded(e.element, true);
let item = this.treeDataProvider.itemMap.get(e.element);
if (item && item.childs) {
this.notifyChangeTreeNodeVisible(item.childs, true);
}
});
this.view.onDidCollapseElement(e => {
this.notifyChangeTreeNodeExpanded(e.element, false);
let item = this.treeDataProvider.itemMap.get(e.element);
if (item && item.childs) {
this.notifyChangeTreeNodeVisible(item.childs, false);
Expand Down Expand Up @@ -205,6 +207,10 @@ export class TreeViewManager extends vscode.Disposable {
notifyClickTreeNode(id: number) {
this.client.notify('clickTreeNode', { id });
}

notifyChangeTreeNodeExpanded(id: number, expanded: boolean) {
this.client.notify('changeTreeNodeExpanded', { id, expanded });
}
}

vscode.commands.registerCommand('y3-helper.custom.treeViewClick', async (managerID, itemUID) => {
Expand Down

0 comments on commit ccc5235

Please sign in to comment.