Skip to content

Notification

github-actions[bot] edited this page Jul 30, 2024 · 6 revisions

notification

Lookup

To get notifications outside the notifications center, one should use a Workbench object:

import { Workbench } from 'vscode-extension-tester';
...
const notifications = await new Workbench().getNotifications();
const notification = notifications[0];

Get Some Info

// get the message
const message = await notification.getMessage();
// get the type (error/warning/info)
const type = await notification.getType();
// get the source as string, if shown
const source = await notification getSource();
// find if there is an active progress bar
const hasProgress = await notification.hasProgress();

Take Action

// dismiss the notification
await notification.dismiss();
// get available actions (buttons)
const actions = await notification.getActions();
// get an action's title (text)
const title = actions[0].getTitle();
// take action (i.e. click a button with title)
await notification.takeAction("Install All");
Clone this wiki locally