From 296a0f304e12b48c858bd7843f59c5fa4582ac2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 12 Aug 2024 17:53:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=8D=E9=80=89=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/console/treeView.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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'); }