Repository navigation
fix(editor): register the drop service before any editor - #6017
Merged
norman-abramovitz merged 2 commits intoOct 15, 2026
Merged
norman-abramovitz merged 2 commits into
norman-abramovitz merged 2 commits into
Conversation
The json language support loads on first use, and the module that starts its worker (monaco-editor internal/common/workers.js) imports most editor features as a side effect, drop-into-editor included. Its treeViewsDndService then registers after the first editor has fixed the editor services, so every editor created later logs "DropIntoEditorController depends on UNKNOWN service treeViewsDndService". The curated subset (eba2569) left drop-into-editor out; the full build had loaded it at startup. Import it with the subset so its service is registered first. Monaco 0.55.1 through 0.57.0 ship the same side-effect imports, so neither upgrade introduced this. The editor chunk grows 4.6 kB (0.8 kB gzip) and the json chunk shrinks 4.2 kB (1.1 kB gzip). The smoke test starts the services with one editor, loads json with a second, and fails on any page error raised by a third.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening a JSON editor (for example the JSON view of a service instance's parameters) and then any other editor logged
[createInstance] DropIntoEditorController depends on UNKNOWN service treeViewsDndServicein the browser console.Cause: Monaco loads its JSON language support on first use. The module that starts the JSON worker (
monaco-editorinternal/common/workers.js) imports almost every editor feature as a side effect, drop-into-editor included. Monaco fixes its editor services once, when the first editor is created, so the drop feature's service registers too late and every editor created afterwards fails to start the feature. The curated Monaco subset (eba2569) left drop-into-editor out; the full build had registered it at startup. Monaco 0.55.1, 0.56.0 and 0.57.0 all ship the same side-effect imports, so neither upgrade introduced this.The fix imports
features/dropOrPasteInto/register.jswith the subset, so the service is registered before any editor exists. About 4.5 kB moves from the JSON chunk to the editor chunk:Tried: a new Monaco smoke test creates a plaintext editor, then a JSON editor (waiting for its diagnostics), then a third editor, and fails on any page error. Against the dev stack it failed with the exact error before the fix and passes after it.
make check gatepasses, including the production build budget.Upstream: microsoft/monaco-editor#5507 reports the side-effect imports (as bundle bloat and features leaking into later editors), and microsoft/monaco-editor#5508 proposes the one-line fix; both are open without a maintainer response. microsoft/monaco-editor#5491 is the same crash with another service (
ICodeLensCache). Until a release carries the fix, the other features the subset leaves out also attach to editors created after JSON loads; only this one needed a service.Refs #6002 (found during its live runs).
Changelog fragment:
changelog.d/0008-monaco-drop-service.md.AI disclosure (RFC-0047): prepared with AI coding assistance; reviewed by the author.