Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface TreeDataProvider<T>

A data provider that provides tree data

Type parameters

  • T

层级

  • TreeDataProvider

索引

Properties(1)

Optional onDidChangeTreeData

onDidChangeTreeData: Event<undefined | null | void | T>

An optional event to signal that an element or root has changed. This will trigger the view to update the changed element/root and its children recursively (if shown). To signal that root has changed, do not pass any argument or pass undefined or null.

Methods(4)

getTreeItem

getChildren

  • Get the children of element or root if no element is passed.

    Parameters

    • Optional element: T

      The element from which the provider gets children. Can be undefined.

    Returns ProviderResult<T[]>

    Children of element or root if no element is passed.

Optional getParent

  • Optional method to return the parent of element. Return null or undefined if element is a child of root.

    NOTE: This method should be implemented in order to access reveal API.

    Parameters

    • element: T

      The element for which the parent has to be returned.

    Returns ProviderResult<T>

    Parent of element.

Optional resolveTreeItem

  • Called on hover to resolve the TreeItem property if it is undefined. Called on tree item click/open to resolve the TreeItem property if it is undefined. Only properties that were undefined can be resolved in resolveTreeItem. Functionality may be expanded later to include being called to resolve other missing properties on selection and/or on open.

    Will only ever be called once per TreeItem.

    onDidChangeTreeData should not be triggered from within resolveTreeItem.

    Note that this function is called when tree items are already showing in the UI. Because of that, no property that changes the presentation (label, description, etc.) can be changed.

    Parameters

    • item: TreeItem

      Undefined properties of item should be set then item should be returned.

    • element: T

      The object associated with the TreeItem.

    • token: CancellationToken

      A cancellation token.

    Returns ProviderResult<TreeItem>

    The resolved tree item or a thenable that resolves to such. It is OK to return the given item. When no result is returned, the given item will be used.

VS Code 插件开发中文文档 | VS Code 中文文档 | VS Code 官网文档 | VS Code 扩展市场

Generated by TypeDoc