microsoft / microsoft/monaco-editor
[Feature Request] Support non-global `MonacoEnvironment`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Context
- This issue is not a bug report. (please use a different template for reporting a bug)
- This issue is not a duplicate of an existing issue. (please use the search to find existing issues)
Description
We ship an embeddable component that uses Monaco.
When the host page also uses Monaco, both instantiations of Monaco will try to read the MonacoEnvironment global variable to initialize workers. If they are different versions of Monaco, this can result in an incompatible worker script being used and cause errors.
To fix this, Monaco could support a scoped version of the MonacoEnvironment variable -- e.g. monaco.setMonacoEnvironment({ getWorkerUrl: ... }) that would take precedence over the global.
Monaco Editor Playground Link
No response
Monaco Editor Playground Code
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how Monaco initializes workers and reads the global MonacoEnvironment described in the issue. Define the scoped environment API and verify that it takes precedence over the global while allowing separate Monaco instances to use compatible worker scripts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100