monaco-textmate
with monaco-editor
Wire Install
npm i monaco-editor-textmate
Please install peer dependencies if you haven't already
npm i monaco-textmate monaco-editor onigasm
Usage
{ await // See https://www.npmjs.com/package/onigasm#light-it-up const registry = getGrammarDefinition: async { return format: 'json' content: await await text } // map of monaco "language id's" to TextMate scopeNames const grammars = grammars grammars grammars await var editor = monacoeditor}
Limitation
monaco-editor
distribution comes with built-in tokenization support for few languages. Because of this monaco-editor-textmate
cannot
be used with monaco-editor
without some modification, see explanation of this problem here.
Solution
To get monaco-editor-textmate
working with monaco-editor
, you're advised to use Webpack with monaco-editor-webpack-plugin
which allows you to control which of "built-in" languages should monaco-editor
use/bundle, leaving the rest.
With that control you must exclude any/all languages for which you'd like to use TextMate grammars based tokenization instead.
License
MIT