Theia API Documentation v1.65.0
    Preparing search index...

    Represents a Tree view

    interface TreeView<T> {
        badge: undefined | ViewBadge;
        description?: string;
        message?: string;
        onDidChangeCheckboxState: Event<TreeCheckboxChangeEvent<T>>;
        onDidChangeSelection: Event<TreeViewSelectionChangeEvent<T>>;
        onDidChangeVisibility: Event<TreeViewVisibilityChangeEvent>;
        onDidCollapseElement: Event<TreeViewExpansionEvent<T>>;
        onDidExpandElement: Event<TreeViewExpansionEvent<T>>;
        selection: readonly T[];
        title?: string;
        visible: boolean;
        dispose(): void;
        reveal(
            element: T,
            options?: { expand?: number | boolean; focus?: boolean; select?: boolean },
        ): Thenable<void>;
    }

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Properties

    badge: undefined | ViewBadge

    The badge to display for this TreeView. To remove the badge, set to undefined.

    description?: string

    An optional human-readable subheading that will be rendered next to the main title. Setting the description to null, undefined, or empty string will remove the message from the view.

    message?: string

    An optional human-readable message that will be rendered in the view. Setting the message to null, undefined, or empty string will remove the message from the view.

    onDidChangeCheckboxState: Event<TreeCheckboxChangeEvent<T>>

    An event to signal that an element or root has either been checked or unchecked.

    onDidChangeSelection: Event<TreeViewSelectionChangeEvent<T>>

    Event that is fired when the selection has changed

    onDidChangeVisibility: Event<TreeViewVisibilityChangeEvent>

    Event that is fired when visibility has changed

    onDidCollapseElement: Event<TreeViewExpansionEvent<T>>

    Event that is fired when an element is collapsed

    onDidExpandElement: Event<TreeViewExpansionEvent<T>>

    Event that is fired when an element is expanded

    selection: readonly T[]

    Currently selected elements.

    title?: string

    The tree view title is initially taken from the extension package.json Changes to the title property will be properly reflected in the UI in the title of the view.

    visible: boolean

    true if the tree view is visible otherwise false.

    Methods

    • Reveals the given element in the tree view. If the tree view is not visible then the tree view is shown and element is revealed.

      By default revealed element is selected. In order to not to select, set the option select to false. In order to focus, set the option focus to true. In order to expand the revealed element, set the option expand to true. To expand recursively set expand to the number of levels to expand.

      • NOTE: In VS Code, you can expand only to 3 levels maximum. This is not the case in Theia, there are no limits to expansion level.
      • NOTE: The TreeDataProvider that the TreeView is registered with with must implement getParent method to access this API.

      Parameters

      • element: T
      • Optionaloptions: { expand?: number | boolean; focus?: boolean; select?: boolean }
        • Optional Readonlyexpand?: number | boolean

          If true, then the element will be expanded. If a number is passed, then up to that number of levels of children will be expanded

        • Optional Readonlyfocus?: boolean

          If true, then the element will be focused.

        • Optional Readonlyselect?: boolean

          If true, then the element will be selected.

      Returns Thenable<void>