diff --git a/src/console/treeView.ts b/src/console/treeView.ts index 87da85a..c6653bd 100644 --- a/src/console/treeView.ts +++ b/src/console/treeView.ts @@ -62,6 +62,13 @@ class TreeDataProvider implements vscode.TreeDataProvider { item.label = data.name; item.description = data.desc; item.tooltip = data.tip; + if (data.check === true) { + item.checkboxState = vscode.TreeItemCheckboxState.Checked; + } else if (data.check === false) { + item.checkboxState = vscode.TreeItemCheckboxState.Unchecked; + } else { + item.checkboxState = undefined; + } if (typeof data.icon === 'string') { item.iconPath = new vscode.ThemeIcon(data.icon); } else { @@ -134,6 +141,7 @@ export interface TreeNodeInfo { desc?: string; tip?: string; icon?: string; + check?: boolean; hasChilds?: boolean; canClick?: boolean; } @@ -170,6 +178,14 @@ export class TreeViewManager extends vscode.Disposable { this.notifyChangeTreeNodeVisible(item.childs, false); } }); + this.view.onDidChangeCheckboxState(e => { + for (const [id, state] of e.items) { + this.client.notify('changeTreeNodeCheckBox', { + id, + checked: state === vscode.TreeItemCheckboxState.Checked, + }); + } + }); vscode.commands.executeCommand('y3-helper.custom.focus'); }