Skip to content

Commit bbd60e6

Browse files
authored
[release] Wait for maximum 3000 ms for the Copilot chat API. (#8610)
2 parents 8c3989d + 5afa11e commit bbd60e6

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)