Skip to content

Commit 11cbfa5

Browse files
authored
Wait for maximum 3000 ms for the Copilot chat API. (#8606)
2 parents 29cb53a + 4dfb71f commit 11cbfa5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lsptoolshost/copilot/contextProviders.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,14 @@ async function getCopilotChatApi(): Promise<CopilotApi | undefined> {
157157

158158
let exports: CopilotChatApi | undefined;
159159
try {
160-
exports = await extension.activate();
160+
exports = await Promise.race([
161+
extension.activate(),
162+
new Promise<undefined>((resolve) => {
163+
setTimeout(() => {
164+
resolve(undefined);
165+
}, 3000);
166+
}),
167+
]);
161168
} catch {
162169
return undefined;
163170
}

0 commit comments

Comments
 (0)