Skip to content

Latest commit

 

History

History
59 lines (50 loc) · 1.48 KB

README_zh.md

File metadata and controls

59 lines (50 loc) · 1.48 KB

vscode-use/treeprovider

English | 简体中文

这个库是为了快速在 vscode 插件中使用 TreeDataProvider 使用侧边栏树,让使用上更加简单

安装

npm i @vscode-use/treeprovider
import { renderTree } from '@vscode-use/treeprovider'
export function activate(context: vscode.ExtensionContext) {
  const { dispose, update } = renderTree(treeData, 'example1.id')
  vscode.commands.registerCommand('refresh-tree', () => { // 更新树
    update([
      {
        label: 'label-2',
        collapsed: true,
        children: [
          {
            label: 'label-2-1',
            command: {
              title: 'label-2-1',
              command: 'command-2',
              arguments: ['2-1']
            }
          }
        ]
      },
      {
        label: 'label-3',
        children: [
          {
            label: 'label-3-1',
            command: {
              title: 'label-3-1',
              command: 'command-3',
              arguments: ['3-1']
            }
          }
        ]
      }
    ])
  })
}

example

License

MIT License © 2022 Simon He

Buy Me A Coffee