monaco-editor: [Bug] CSS WorkerManager is no longer accessible/public
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not 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
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 16 (5 by maintainers)
Commits related to this issue
- More exports for #2834 — committed to microsoft/monaco-editor by alexdima 3 years ago
@mifopen I’ve also pushed a change to export those classes in
vs/language/typescript/tsMode.jsTo 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 fromcssMode.ts.@alexdima Sry if I was not clear enough - I only meant from YOUR (users) perspective 😊 I do use a lot of inner stuff not in the
monaco.d.tsto make cool thing happen, but maybe I should investigate just using the typescript source instead of ESM/AMD as my project is TS already - don’t know if that is event possible… And thanks!