Skip to content

ContextMenuItem

github-actions[bot] edited this page Apr 23, 2024 · 3 revisions

contextMenuItem

Lookup

One can retrieve an item from an open context menu, much like follows:

import { ActivityBar } from 'vscode-extension-tester';
...
const menu = await new ActivityBar().openContextMenu();
const item = await menu.getItem('References');

Select/Click

// if item has no children
await item.select();
// if there is a submenu under the item
const submenu = await item.select();

Get Parent Menu

const parentMenu = item.getParent();

Get Label

const label = await item.getLabel();