Skip to content

Use withServices to detect early Monaco initialization#17361

Open
colin-grant-work wants to merge 1 commit intomasterfrom
bugfix/monaco-instantiation-false-positives-17245
Open

Use withServices to detect early Monaco initialization#17361
colin-grant-work wants to merge 1 commit intomasterfrom
bugfix/monaco-instantiation-false-positives-17245

Conversation

@colin-grant-work
Copy link
Copy Markdown
Contributor

What it does

Fixes #17245 by using a targeted check to detect whether Monaco services had been initialized before our call to StandaloneServices.initialize

How to test

  1. In the normal case, you should not see the log reported in Monaco new console error #17245
  2. If you put a breakpoint after our call to StandaloneServices.initialize, you should see that isInitialized is true and servicesInitializedBeforeOverrides is false, since we have then initialized the services, but they hadn't been initialized before our call.

Follow-ups

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

@github-project-automation github-project-automation Bot moved this to Waiting on reviewers in PR Backlog Apr 16, 2026
@colin-grant-work colin-grant-work force-pushed the bugfix/monaco-instantiation-false-positives-17245 branch from 38838f5 to 978c4be Compare April 21, 2026 21:15
@ndoschek ndoschek requested a review from cdamus April 23, 2026 07:48
Copy link
Copy Markdown
Contributor

@cdamus cdamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the job! I do have a nit for you to consider if you're keen.

Comment on lines +242 to +243
const serviceCollection: ServiceCollection | undefined = instantiationService?._services;
if (serviceCollection) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: If for whatever reason the private _services changes in a future release then serviceCollection may end up falsy. If we think we need to patch services but we don't get the collection we expect, then we silently fail to do anything. We should probably check that we got a ServicesCollection of the correct shape and log if not.

@github-project-automation github-project-automation Bot moved this from Waiting on reviewers to Needs merge in PR Backlog Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs merge

Development

Successfully merging this pull request may close these issues.

Monaco new console error

2 participants