@kkdev92/vscode-ext-kit - v4.1.1
    Preparing search index...

    Class BaseTreeDataProvider<T>Abstract

    Abstract base class for tree data providers.

    A class on purpose, against this codebase's factory-function default, because subclassing is the interface: a provider is defined by what its getRoots/getChildrenOf overrides return, and a factory taking those two as callbacks would be the same thing with more ceremony.

    class FileTreeProvider extends BaseTreeDataProvider<FileItem> {
    async getRoots(): Promise<FileItem[]> {
    return [{ id: 'src', label: 'src', collapsibleState: TreeItemCollapsible.Collapsed }];
    }
    async getChildrenOf(element: FileItem): Promise<FileItem[]> {
    return listChildren(element);
    }
    }

    Type Parameters

    Hierarchy (View Summary)

    Implements

    Index
    _disposed: boolean = false
    _onDidChangeTreeData: Emitter<T | undefined> = ...

    Emits invalidation requests consumed by the adapter. Protected so a specialized provider can expose richer refresh methods without replacing the public event contract.

    onDidChangeCheckboxState: (
        listener: (changes: TreeCheckboxChange<T>[]) => void,
    ) => PlatformRegistration = ...

    Fires when the user (un)checks a checkbox in the tree. The host bridges the native event for any view declared with module.treeViews.add, so there is nothing to wire up.

    onDidChangeTreeData: (
        listener: (element: T | undefined) => void,
    ) => PlatformRegistration = ...

    Event the platform subscribes to; emit through refresh.

    • Clears the internal child cache without emitting an invalidation event. Call refresh when the platform must immediately query again.

      Returns void

    • Gets the children of an element. Override this method to provide child items.

      Parameters

      • element: T

        Parent element

      Returns T[] | Promise<T[]>

    • Gets the parent of an element. Override this method to support TreeView.reveal().

      Parameters

      • element: T

        Child element

      Returns T | Promise<T | undefined> | undefined

    • Renders one element.

      An element already is the row's data, so this normalises rather than builds: it fills in the collapsible state and hands back plain data the adapter turns into the platform's TreeItem. Override it to render an element differently from how it is stored.

      Parameters

      • element: T

        Tree item data

      Returns TreeItemLike

    • Refreshes the tree view.

      Passing a specific element (rather than undefined) is the partial-update path: VS Code only re-fetches that element's own getTreeItem() rendering and its children, leaving the rest of the tree's scroll position, selection, and expand/collapse state untouched.

      Parameters

      • Optionalelement: T

        Specific element to refresh, or undefined for the entire tree

      Returns void

    • Notifies listeners that the given items' checkbox state changed. The host calls this; an application normally only listens.

      Parameters

      • changes: readonly { checked: boolean; element: T }[]

        The items that were checked or unchecked

      Returns void