MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / timeout

Method timeout

Extension/src/LanguageServer/client.ts:2617–2625  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2615
2616 // Create a promise that rejects in <ms> milliseconds
2617 const timeout: () => Promise<T> = () => new Promise<T>((resolve, reject) => {
2618 timer = global.setTimeout(() => {
2619 clearTimeout(timer);
2620 if (cancelToken) {
2621 cancelToken.cancel();
2622 }
2623 reject(localize("timed.out", "Timed out in {0}ms.", ms));
2624 }, ms);
2625 });
2626
2627 // Returns a race between our timeout and the passed in promise
2628 return Promise.race([task(), timeout()]).then(

Calls 1

cancelMethod · 0.65

Tested by

no test coverage detected