diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts index c5439c33e79..bc9632cd2a3 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts @@ -158,48 +158,6 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re }; }; - const runRenderScript = async (url: string, rendererId: string): Promise => { - const text = await loadScriptSource(url); - // TODO: Support both the new module based renderers and the old style global renderers - const isModule = !text.includes('acquireNotebookRendererApi'); - if (isModule) { - return __import(url); - } else { - return createBackCompatModule(rendererId, url, text); - } - }; - - const createBackCompatModule = (rendererId: string, scriptUrl: string, scriptText: string): ScriptModule => ({ - activate: (): RendererApi => { - const onDidCreateOutput = createEmitter(); - const onWillDestroyOutput = createEmitter(); - - const globals = { - scriptUrl, - acquireNotebookRendererApi: (): GlobalNotebookRendererApi => ({ - onDidCreateOutput: onDidCreateOutput.event, - onWillDestroyOutput: onWillDestroyOutput.event, - setState: newState => vscode.setState({ ...vscode.getState(), [rendererId]: newState }), - getState: () => { - const state = vscode.getState(); - return typeof state === 'object' && state ? state[rendererId] as T : undefined; - }, - }), - }; - - invokeSourceWithGlobals(scriptText, globals); - - return { - renderOutputItem(outputItem) { - onDidCreateOutput.fire({ ...outputItem, outputId: outputItem.id }); - }, - disposeOutputItem(id) { - onWillDestroyOutput.fire(id ? { outputId: id } : undefined); - } - }; - } - }); - const dimensionUpdater = new class { private readonly pending = new Map(); @@ -477,20 +435,8 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re bytes(): Uint8Array; } - interface IDestroyCellInfo { - outputId: string; - } - const onDidReceiveKernelMessage = createEmitter(); - /** @deprecated */ - interface GlobalNotebookRendererApi { - setState: (newState: T) => void; - getState(): T | undefined; - readonly onWillDestroyOutput: Event; - readonly onDidCreateOutput: Event; - } - const kernelPreloadGlobals = { acquireVsCodeApi, onDidReceiveKernelMessage: onDidReceiveKernelMessage.event, @@ -766,7 +712,7 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re /** Inner function cached in the _loadPromise(). */ private async _load(): Promise { - const module = await runRenderScript(this.data.entrypoint, this.data.id); + const module = await __import(this.data.entrypoint); if (!module) { return; }