From a75a0495bc8c3e5774d754112dde5b4f9b42ee57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Tue, 29 Oct 2024 12:09:47 +0100 Subject: [PATCH 1/2] fix: fix broken VSCode worker bootstrap --- .../0058-fix-fix-missing-worker-factory.patch | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 vscode-paches/0058-fix-fix-missing-worker-factory.patch diff --git a/vscode-paches/0058-fix-fix-missing-worker-factory.patch b/vscode-paches/0058-fix-fix-missing-worker-factory.patch new file mode 100644 index 00000000..3af3f664 --- /dev/null +++ b/vscode-paches/0058-fix-fix-missing-worker-factory.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= +Date: Tue, 29 Oct 2024 12:00:15 +0100 +Subject: [PATCH] fix: fix missing worker factory + +--- + .../common/services/editorSimpleWorker.esm.ts | 5 +---- + .../common/services/editorWorkerBootstrap.ts | 15 +++------------ + 2 files changed, 4 insertions(+), 16 deletions(-) + +diff --git a/src/vs/editor/common/services/editorSimpleWorker.esm.ts b/src/vs/editor/common/services/editorSimpleWorker.esm.ts +index 8d0e18738f4..795f00d68c3 100644 +--- a/src/vs/editor/common/services/editorSimpleWorker.esm.ts ++++ b/src/vs/editor/common/services/editorSimpleWorker.esm.ts +@@ -3,7 +3,4 @@ + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +-import { create } from './editorSimpleWorker.js'; +-import { bootstrapSimpleEditorWorker } from './editorWorkerBootstrap.js'; +- +-bootstrapSimpleEditorWorker(create); ++import './editorWorkerBootstrap.js'; +diff --git a/src/vs/editor/common/services/editorWorkerBootstrap.ts b/src/vs/editor/common/services/editorWorkerBootstrap.ts +index f754fe8fd4a..27bb817ac9b 100644 +--- a/src/vs/editor/common/services/editorWorkerBootstrap.ts ++++ b/src/vs/editor/common/services/editorWorkerBootstrap.ts +@@ -4,7 +4,7 @@ + *--------------------------------------------------------------------------------------------*/ + + import { IWorkerServer, SimpleWorkerServer } from '../../../base/common/worker/simpleWorker.js'; +-import { EditorSimpleWorker } from './editorSimpleWorker.js'; ++import { EditorSimpleWorker, IForeignModuleFactory } from './editorSimpleWorker.js'; + import { EditorWorkerHost } from './editorWorkerHost.js'; + + type MessageEvent = { +@@ -18,7 +18,7 @@ declare const globalThis: { + + let initialized = false; + +-export function initialize(factory: any) { ++export function initialize(factory: IForeignModuleFactory | null) { + if (initialized) { + return; + } +@@ -26,7 +26,7 @@ export function initialize(factory: any) { + + const simpleWorker = new SimpleWorkerServer((msg) => { + globalThis.postMessage(msg); +- }, (workerServer: IWorkerServer) => new EditorSimpleWorker(EditorWorkerHost.getChannel(workerServer), null)); ++ }, (workerServer: IWorkerServer) => new EditorSimpleWorker(EditorWorkerHost.getChannel(workerServer), factory)); + + globalThis.onmessage = (e: MessageEvent) => { + simpleWorker.onmessage(e.data); +@@ -40,12 +40,3 @@ globalThis.onmessage = (e: MessageEvent) => { + } + }; + +-type CreateFunction = (ctx: C, data: D) => R; +- +-export function bootstrapSimpleEditorWorker(createFn: CreateFunction) { +- globalThis.onmessage = () => { +- initialize((ctx: C, createData: D) => { +- return createFn.call(self, ctx, createData); +- }); +- }; +-} From e94eb7129d64b65baed6c4329b69f968214da900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Tue, 29 Oct 2024 12:10:06 +0100 Subject: [PATCH 2/2] fix: use new shorted syntax for workers --- src/workers/editor.worker.ts | 2 +- src/workers/languageDetection.worker.ts | 11 +---------- src/workers/localFileSearch.worker.ts | 11 +---------- src/workers/notebook.worker.ts | 11 +---------- src/workers/outputLinkComputer.worker.ts | 11 +---------- src/workers/textmate.worker.ts | 11 +---------- 6 files changed, 6 insertions(+), 51 deletions(-) diff --git a/src/workers/editor.worker.ts b/src/workers/editor.worker.ts index 817f7ded..da270568 100644 --- a/src/workers/editor.worker.ts +++ b/src/workers/editor.worker.ts @@ -1 +1 @@ -export * from 'vs/editor/editor.worker' +export * from 'vs/editor/common/services/editorSimpleWorker.esm.js' diff --git a/src/workers/languageDetection.worker.ts b/src/workers/languageDetection.worker.ts index 43056d4c..9b070e85 100644 --- a/src/workers/languageDetection.worker.ts +++ b/src/workers/languageDetection.worker.ts @@ -1,10 +1 @@ -import { create } from 'vs/workbench/services/languageDetection/browser/languageDetectionSimpleWorker' -import { SimpleWorkerServer } from 'vs/base/common/worker/simpleWorker' - -const simpleWorker = new SimpleWorkerServer((msg) => { - globalThis.postMessage(msg) -}, create) - -globalThis.onmessage = (e: MessageEvent) => { - simpleWorker.onmessage(e.data) -} +import 'vs/workbench/services/languageDetection/browser/languageDetectionSimpleWorker.esm.js' diff --git a/src/workers/localFileSearch.worker.ts b/src/workers/localFileSearch.worker.ts index 8a6eb95b..f9f883dd 100644 --- a/src/workers/localFileSearch.worker.ts +++ b/src/workers/localFileSearch.worker.ts @@ -1,10 +1 @@ -import { create } from 'vs/workbench/services/search/worker/localFileSearch' -import { SimpleWorkerServer } from 'vs/base/common/worker/simpleWorker' - -const simpleWorker = new SimpleWorkerServer((msg) => { - globalThis.postMessage(msg) -}, create) - -globalThis.onmessage = (e: MessageEvent) => { - simpleWorker.onmessage(e.data) -} +import 'vs/workbench/services/search/worker/localFileSearch.esm.js' diff --git a/src/workers/notebook.worker.ts b/src/workers/notebook.worker.ts index 116ba141..5d291673 100644 --- a/src/workers/notebook.worker.ts +++ b/src/workers/notebook.worker.ts @@ -1,10 +1 @@ -import { create } from 'vs/workbench/contrib/notebook/common/services/notebookSimpleWorker' -import { SimpleWorkerServer } from 'vs/base/common/worker/simpleWorker' - -const simpleWorker = new SimpleWorkerServer((msg) => { - globalThis.postMessage(msg) -}, create) - -globalThis.onmessage = (e: MessageEvent) => { - simpleWorker.onmessage(e.data) -} +import 'vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.esm.js' diff --git a/src/workers/outputLinkComputer.worker.ts b/src/workers/outputLinkComputer.worker.ts index 49b3a688..f2d8db7a 100644 --- a/src/workers/outputLinkComputer.worker.ts +++ b/src/workers/outputLinkComputer.worker.ts @@ -1,10 +1 @@ -import { SimpleWorkerServer } from 'vs/base/common/worker/simpleWorker' -import { create } from 'vs/workbench/contrib/output/common/outputLinkComputer' - -const simpleWorker = new SimpleWorkerServer((msg) => { - globalThis.postMessage(msg) -}, create) - -globalThis.onmessage = (e: MessageEvent) => { - simpleWorker.onmessage(e.data) -} +import 'vs/workbench/contrib/output/common/outputLinkComputer.esm.js' diff --git a/src/workers/textmate.worker.ts b/src/workers/textmate.worker.ts index d907ac6d..c182d656 100644 --- a/src/workers/textmate.worker.ts +++ b/src/workers/textmate.worker.ts @@ -1,10 +1 @@ -import { create } from 'vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.worker' -import { SimpleWorkerServer } from 'vs/base/common/worker/simpleWorker' - -const simpleWorker = new SimpleWorkerServer((msg) => { - globalThis.postMessage(msg) -}, create) - -globalThis.onmessage = (e: MessageEvent) => { - simpleWorker.onmessage(e.data) -} +import 'vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.worker.esm.js'