Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TreeItem

Hierarchy

  • TreeItem
    • TreeItem

Index

Constructors

constructor

  • new TreeItem(label: string | TreeItemLabel, collapsibleState?: TreeItemCollapsibleState): TreeItem
  • new TreeItem(resourceUri: Uri, collapsibleState?: TreeItemCollapsibleState): TreeItem
  • Parameters

    • label: string | TreeItemLabel

      A human-readable string describing this item

    • Optional collapsibleState: TreeItemCollapsibleState

      {@link TreeItemCollapsibleState} of the tree item. Default is {@link TreeItemCollapsibleState.None}

    Returns TreeItem

  • Parameters

    • resourceUri: Uri

      The {@link Uri} of the resource representing this item.

    • Optional collapsibleState: TreeItemCollapsibleState

      {@link TreeItemCollapsibleState} of the tree item. Default is {@link TreeItemCollapsibleState.None}

    Returns TreeItem

Properties

Optional accessibilityInformation

accessibilityInformation: AccessibilityInformation

Accessibility information used when screen reader interacts with this tree item. Generally, a TreeItem has no need to set the role of the accessibilityInformation; however, there are cases where a TreeItem is not displayed in a tree-like way where setting the role may make sense.

Optional childProvider

childProvider: string

Optional collapsibleState

collapsibleState: TreeItemCollapsibleState

{@link TreeItemCollapsibleState} of the tree item.

Optional command

command: Command

The {@link Command} that should be executed when the tree item is selected.

Please use vscode.open or vscode.diff as command IDs when the tree item is opening something in the editor. Using these commands ensures that the resulting editor will appear consistent with how other built-in trees open editors.

Optional contextValue

contextValue: string

Context value of the tree item. This can be used to contribute item specific actions in the tree. For example, a tree item is given a context value as folder. When contributing actions to view/item/context using menus extension point, you can specify context value for key viewItem in when expression like viewItem == folder.

   "contributes": {
       "menus": {
           "view/item/context": [
               {
                   "command": "extension.deleteFolder",
                   "when": "viewItem == folder"
               }
           ]
       }
   }

This will show action extension.deleteFolder only for items with contextValue is folder.

Optional description

description: string | boolean

A human-readable string which is rendered less prominent. When true, it is derived from resourceUri and when falsy, it is not shown.

Optional iconPath

iconPath: string | Uri | { dark: string | Uri; light: string | Uri } | ThemeIcon

The icon path or {@link ThemeIcon} for the tree item. When falsy, {@link ThemeIcon.Folder Folder Theme Icon} is assigned, if item is collapsible otherwise {@link ThemeIcon.File File Theme Icon}. When a file or folder {@link ThemeIcon} is specified, icon is derived from the current file icon theme for the specified theme icon using resourceUri (if provided).

Optional id

id: string

Optional id for the tree item that has to be unique across tree. The id is used to preserve the selection and expansion state of the tree item.

If not provided, an id is generated using the tree item's label. Note that when labels change, ids will change and that selection and expansion state cannot be kept stable anymore.

Optional label

label: string | TreeItemLabel

A human-readable string describing this item. When falsy, it is derived from resourceUri.

Optional payload

Optional resourceUri

resourceUri: Uri

The {@link Uri} of the resource representing this item.

Will be used to derive the label, when it is not provided. Will be used to derive the icon from current file icon theme, when iconPath has {@link ThemeIcon} value.

Optional tooltip

tooltip: string | MarkdownString

The tooltip text when you hover over this item.

Optional type

Generated using TypeDoc