MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / activateExtensionScript

Function activateExtensionScript

src/test/index.node.ts:146–157  ·  view source on GitHub ↗

* Waits until the Python Extension completes loading or a timeout. * When running tests within VSC, we need to wait for the Python Extension to complete loading, * this is where `initialize` comes in, we load the PVSC extension using VSC API, wait for it * to complete. * That's when we know out

()

Source from the content-addressed store, hash-verified

144 * @returns
145 */
146function activateExtensionScript() {
147 const ex = new Error('Failed to initialize Python Extension for tests after 3 minutes');
148 let timer: NodeJS.Timer | undefined;
149 const failed = new Promise((_, reject) => {
150 timer = setTimeout(() => reject(ex), MAX_EXTENSION_ACTIVATION_TIME);
151 });
152 const initializationPromise = initialize();
153 const promise = Promise.race([initializationPromise, failed]);
154 // eslint-disable-next-line no-console
155 promise.finally(() => clearTimeout(timer! as any)).catch((e) => console.error(e));
156 return initializationPromise;
157}
158
159/**
160 * Runner, invoked by VS Code.

Callers 1

runFunction · 0.85

Calls 2

initializeFunction · 0.90
errorMethod · 0.65

Tested by

no test coverage detected