monaco-vscode-editor-api is missing some files
Description
I upgraded from version 7 to 8 and used monaco-vscode-editor-api to replace monaco-editor-treemended as per the docs.
But monaco-vscode-editor-api miss some files. e.g. metadata.js which is used by monaco-editor-webpack-plugin.
Before:
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.16 <1.84.0",
"monaco-languageclient": "~7.2.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.16 <1.84.0",
Now:
"monaco-editor": "npm:@codingame/[email protected]",
"monaco-languageclient": "8.3.1",
"vscode": "npm:@codingame/[email protected]",
Here is a list of files for monaco-vscode-editor-api:
Here is a list of files for
monaco-editor-treemended:
Expectation
Upgrade to v8 with minimal changes.
Thanks.
As stated in the readme, the webpack plugin can't be used anymore
@xueerli see here: https://github.com/CodinGame/monaco-vscode-api#if-you-use-webpack
@kaisalmen thank you for your response.
In addition to monaco-editor-webpack-plugin, there is no setLocale method in monaco-editor/esm/vs/nls .
There is also no monaco-editor/esm/vs/platform/actions/common/actions to handle context menus.
There is even no vs/nls file in the editor api, why are you trying to access it directly?
Exposed modules are whitelisted, and vs/platform/actions/common/actions is currently not part of it, what do you need it for?
@CGNonofr
I use vs/nls setLocale to set locale language.
I use vs/platform/actions/common/actions to delete some actions.
In previous versions of treemended, it was possible to import from monaco-editor.
I'm not sure why you would want to call setLocale by hands?
You should be able to import vscode/vscode/XXX instead of monaco-editor/esm/XXX though
@xueerli we even have a utility for loading locales available: https://github.com/TypeFox/monaco-languageclient/blob/main/packages/examples/wrapper_statemachine.html#L18-L22
It must be loaded before anything else. Usage is demonstrate here: https://github.com/TypeFox/monaco-languageclient/blob/main/index.html#L41
@CGNonofr I use ESM. Shouldn't I set Locale manually? I couldn't find a better way. Here's a related issue https://github.com/microsoft/monaco-editor/issues/1514.
We are using our own localization mechanism here, inspired by what is used in VSCode, adpated to work in ESM (VScode is built into commonjs/umd and they inject the localization at runtime, which is not possible with ESM)
setLocale is an internal api and you're not supposed to call it by hands. you would need to give the localization content as parameter
@CGNonofr @kaisalmen
Thank you so much. Referring to your implementation, I'll try registerLocalization in vscode/l10n.
Why don't you use what @kaisalmen suggested?
https://github.com/TypeFox/monaco-languageclient/issues/655#issuecomment-2144469817 describes the best way forward.