question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] CSS WorkerManager is no longer accessible/public

See original GitHub issue

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Code

No response

Actual Behavior

No response

Expected Behavior

No response

Additional Context

As mentioned here: https://github.com/microsoft/monaco-editor/issues/2746#issuecomment-994927923

OLD

I use CSS completion from HTML. To do so I have done this:

languageId = "html";
require(['vs/language/css/cssMode', 'vs/language/css/cssWorker'], (mode: any, workerMod: any) => {
	// THIS no longer works
	const workerManager = require('vs/language/css/workerManager');
	const worker = function () {
		return client.getLanguageServiceWorker.apply(client, arguments);
	}
	// THIS no longer works
	const languageFeatures = require('vs/language/css/languageFeatures');
	monaco.languages.registerCompletionItemProvider(languageId, new languageFeatures.CompletionAdapter(worker));

HACK

To make it work I go to cssMode.js and add:

__export(cssMode_exports, {
	setupMode: () => setupMode,
	// THIS makes it work
	WorkerManager: () => WorkerManager,
	CompletionAdapter: () => CompletionAdapter,
});

Then I can replace the = requre( with this:

const workerManager = mode;
const languageFeatures = mode;

FIX

Can I have the WorkerManager adapters to becomes “public” again?

This is my first encounter, I will test the other languages and extensions to see if there are more. I know this is not in the public documented stuff - but it would be really nice to have access to these advanced features.

Thanks

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
alexdimacommented, Dec 16, 2021

@mifopen I’ve also pushed a change to export those classes in vs/language/typescript/tsMode.js

2reactions
alexdimacommented, Dec 16, 2021

To clarify, this is not a regression because these classes were internal and not part of the API described in monaco.d.ts. But I also don’t think it is a problem for us to re-export these classes from cssMode.ts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Merging monaco repositories · Issue #2746 - GitHub
I can no longer create the WorkerManager from/for e.g. CSS as its hidden/not exported now.. Will this change?
Read more >
Android Work Manager: "Could not instantiate Worker"
I've followed the Android Developer's tutorial on using the Worker Manager structure to run my code in background but anytime ...
Read more >
WorkManager - Android Developers
Applications can no longer launch a foreground service when they are in the background. Therefore, to better support long running work which was...
Read more >
Using WorkManager in multi-process apps | by Ben Weiss
The recent release of WorkManager 2.5.0 enables easier usage in a multi-process environment and provides several stability improvements.
Read more >
WorkManager's OneTimeWorkRequest stays in enqueued ...
You will need to initialize WorkManager with a custom configuration for that. * Remove the default WorkManager initializer using: <provider android:name=" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found