Skip to content
This repository was archived by the owner on Jul 2, 2026. It is now read-only.

Commit f014153

Browse files
Cristi/notifications (#94)
* feat: refactor extension config * fix: getnotifications * feat: refactor extension config * fix: getnotifications * chore: revert change
1 parent 5142b57 commit f014153

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/ui-interaction/notifications.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,35 @@ async function findNotification(
146146
log(`Error opening notifications center: ${error}`);
147147
await executeQuickPick('Notifications: Show Notifications');
148148
}
149+
150+
// Try the standard API first
149151
const notifications = await workbench.getNotifications();
150152
for (const notification of notifications) {
151153
const notificationMessage = await notification.getMessage();
152154
if (message.test(notificationMessage)) {
153155
return notification as unknown as Notification;
154156
}
155157
}
158+
159+
// Fallback: workbench.getNotifications() looks at .notifications-toasts (ephemeral),
160+
// but notifications are in .notifications-center (persistent panel).
161+
// Query the notifications-center directly as a workaround for VS Code 1.102+.
162+
try {
163+
const browser = getBrowser();
164+
const centerElements = await browser.findElements(
165+
By.css('.notifications-center .notification-list-item-message')
166+
);
167+
for (const element of centerElements) {
168+
const text = await element.getText();
169+
if (message.test(text)) {
170+
// Found it! Return a minimal notification-like object
171+
return { getMessage: async () => text } as unknown as Notification;
172+
}
173+
}
174+
} catch {
175+
// DOM query failed, fall through to return null
176+
}
177+
156178
return null;
157179
};
158180

0 commit comments

Comments
 (0)