Skip to content

feat: add worker factory option for Monaco Editor >= 0.55#282

Open
ttys026 wants to merge 2 commits intoremcohaszing:mainfrom
ttys026:feat/monaco-055-worker-option
Open

feat: add worker factory option for Monaco Editor >= 0.55#282
ttys026 wants to merge 2 commits intoremcohaszing:mainfrom
ttys026:feat/monaco-055-worker-option

Conversation

@ttys026
Copy link
Copy Markdown

@ttys026 ttys026 commented Mar 24, 2026

Monaco Editor 0.55 changed the createWebWorker API to require a Worker instance via opts.worker. Additionally, createData is no longer sent through the worker message protocol.

This adds a worker option to configureMonacoYaml() that allows consumers to provide their own Worker factory function. When provided, the worker manager intercepts the postMessage sequence to inject createData before the RPC INITIALIZE message, preserving compatibility with the existing yaml worker protocol.

For Monaco < 0.55, omit the worker option and use MonacoEnvironment as before. Updated README with usage examples for both Vite and Webpack.

Monaco Editor 0.55 changed the createWebWorker API to require a Worker
instance via opts.worker. Additionally, createData is no longer sent
through the worker message protocol.

This adds a `worker` option to `configureMonacoYaml()` that allows
consumers to provide their own Worker factory function. When provided,
the worker manager intercepts the postMessage sequence to inject
createData before the RPC INITIALIZE message, preserving compatibility
with the existing yaml worker protocol.

For Monaco < 0.55, omit the worker option and use MonacoEnvironment as
before. Updated README with usage examples for both Vite and Webpack.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 24, 2026

Deploy Preview for monaco-yaml ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1304d5c
🔍 Latest deploy log https://app.netlify.com/projects/monaco-yaml/deploys/69c2c1b06452690008dbb0a4
😎 Deploy Preview https://deploy-preview-282--monaco-yaml.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Update all three examples (demo, vite-example, monaco-editor-webpack-plugin)
to use monaco-editor 0.55.1 and the new `worker` option in configureMonacoYaml.
The yaml worker case is removed from MonacoEnvironment.getWorker since it's now
handled directly by the worker option.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ttys026
Copy link
Copy Markdown
Author

ttys026 commented Mar 24, 2026

Mostly done by AI, but it did fix my issue.
Related remcohaszing/monaco-prettier#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant