Skip to content

vscode-use/treeprovider

Repository files navigation

vscode-use/treeprovider

English | 简体中文

This library is designed to quickly use the tree data provider in the vscode plugin using sidebar trees to make it easier to use

Install

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 the 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