Exclude built-in languages from loading
monaco-editor version: 0.15.5 Browser: Any OS: Any
I have created a custom language with auto complete provider and syntax highlighting. Works great. I noticed however that all the languages in the basic-languages folder are all getting loaded. This adds extra overhead to our load time (we don't need any of them). Is there a way to exclude them from being loaded at all?
It looks like they are getting loaded at the bottom of main.editor.js and I don't see anything that would allow me to exclude them from getting loaded. Hoping someone else will know.
Thanks
I thought they're loaded lazily and the actual loading shouldn't happen until you have a model with a language id equal to those built-in ones. So as long as your editor's language is not one of them you should be safe.
You could also try to use the monaco-editor-core npm module, it's also maintained my MS and does not contain the built-in languages & language servers.
@vasiltabakov I looked at the demo here: https://microsoft.github.io/monaco-editor/ and sure enough, all the languages aren't loading. For some reason, all the ones in the basic-languages folder for me are. I'm not sure what the difference is ... yet
@mofux does monaco-editor-core allow colorization, custom language, auto completion, suggestion... everything I would need for my own custom language?
I'm on 0.16.0 and requiring editor.main loads this bunch of contribution from basic-languages. I'm not sure if that's related.

Note: these files doesn't even exist. The files get loaded because they get a html response, but it's not close to being those files >.<
EDIT: Fixed this. Caused because I was importing twice the editor and one was the dev version. My bad.
well, I am running into this issue as well, is there any documentation on how to explicitly exclude loading language contributions you don't need?
in the website is not a really good example to follow because they load it using AMD, hence why it loads only what is needed.
the issue I have and most people here as well is because we're using webpack import's and bundling them, so probably basic-languages is not tree-shakable and also not lazy loaded in webpack bundles.
please correct me if I'm wrong, just exploring so far
@armand1m for me, that is correct. We are bundling ours. Still an issue for us, but since it is an intranet app, less of an issue, but it would be nice to have less stuff loading that really isn't needed.
I'm giving a try on https://github.com/microsoft/monaco-editor-webpack-plugin, as you can set the languages to get bundled as a parameter of the plugin constructor, maybe will help you as well =)
@armand1m It won't for me, but hopefully it will help someone else. Thanks
The *.contribution files are super tiny and they simply define the fact that a language exists. They are fine to be loaded all the time, and the expectation is that they get bundled in your application, either via webpack, rollup, or by you using the /min AMD bundled version.
Once a model with a certain language is loaded, these tiny definitions are consulted and if a language is found, then the real language coloring / configuration / web worker are loaded.