I can define tokens with setMonarchTokensProvider, but that does not really help because I can only make a new language or overwrite typescript. In either case I do not have the rest of the typescript tokens which I still want to have.
I just want to add one token, which will have a specific meaning in the context of this editor, which I want to colorize. While still having all of typescript.
This is what I have till now (taken form the playground examples), but with this the rest of typescript is gone:
monaco.languages.setMonarchTokensProvider('typescript', {
tokenizer: {
root: [
[/\pvm.*/, "custom-error"]
]
}
});
monaco.editor.defineTheme('myCoolTheme', {
base: 'vs',
inherit: true,
rules: [
{ token: 'custom-error', foreground: 'ff0000', fontStyle: 'bold' }
]
});
(And then using theme myCoolTheme when creating the editor)
I ended up finding the language .js file and adding the customization there. Not the way I'd like to do it, but it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With