Skip to content

Commit

Permalink
支持复选框
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Aug 12, 2024
1 parent c382944 commit 296a0f3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/console/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ class TreeDataProvider implements vscode.TreeDataProvider<number> {
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 {
Expand Down Expand Up @@ -134,6 +141,7 @@ export interface TreeNodeInfo {
desc?: string;
tip?: string;
icon?: string;
check?: boolean;
hasChilds?: boolean;
canClick?: boolean;
}
Expand Down Expand Up @@ -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');
}

Expand Down

0 comments on commit 296a0f3

Please sign in to comment.