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)