Skip to content

ViewItem

github-actions[bot] edited this page May 16, 2024 · 4 revisions

item

Lookup

The best way to get an item reference is to use the findItem method from ViewSection.

const viewSection = ...;
const item = await viewSection.findItem('package.json');

Actions

// get item's label
const label = item.getLabel();
// find if the item can be expanded
const isExpandable = await item.isExpandable();
// try to expand the item and find if it has children
const isParent = await item.hasChildren();
// find if item is expanded
const isExpanded = await item.isExpanded();
// collapse the item if expanded
await item.collapse();
// select the item and get its children if it ends up expanded, otherwise get an empty array
const children = await item.select();
// get the tooltip if present
const tooltip = await item.getTooltip();