Search code examples
monaco-editor

Grammar injections in Monaco?


Any idea how I'd accomplish injecting a TextMate grammar into an existing Monarch grammar (as indicated here: https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#injection-grammars) using Monaco's API?

Basically, I'm trying to bring vscode-styled-components's functionality over to Monaco, and I'm at a loss for how to do it. I've studied the code responsible for registering extension grammar contributions, as well as the code for tokenization, and I just can't quite figure out how it all connects.

Thanks!


Solution

  • That's not possible. TextMate grammars are an addition to Monaco from vscode. You will have to parse and convert the grammars yourself to load them into Monaco.