Skip to content

Commit 0fec59e

Browse files
author
Siddharth Saladi
committed
Handle selectChannel NoSuchElementError - retry until LS output channel is registered
1 parent 534da11 commit 0fec59e

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/test/utils/testUtils.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,18 @@ export async function waitForLanguageServerInit(
7272
}
7373
await wait.sleep(500);
7474

75-
// Select the specific output channel
76-
await outputView.selectChannel(channelName);
75+
// Select the specific output channel.
76+
// The channel option may not exist yet if the language server hasn't
77+
// registered its output channel — treat as retry.
78+
try {
79+
await outputView.selectChannel(channelName);
80+
} catch (selErr: any) {
81+
logger.info(`selectChannel failed (${selErr.name}), channel not yet registered, will retry...`);
82+
await dismissNotifications();
83+
await bottomBar.toggle(false);
84+
await wait.sleep(2000);
85+
return false;
86+
}
7787
await wait.sleep(1000);
7888

7989
// Click in the output view to focus it, then use clipboard to get content

0 commit comments

Comments
 (0)