monaco-editor

How to set up Monaco editor to highlight logs in the same way as VS Code does


I'm looking for a way to make Monaco properly detect and highlight stack traces in log files.

I tried setting the language to log but that doesn't work.

VS Code highlights stack traces in italics and in a different color which is great for readability.

VS Code

With Monaco, it's all the same.

Monaco


Solution

  • You might be able to achieve this with your own custom language - see e.g. Monaco Playground > Custom Languages and a related GitHub project. See also https://github.com/microsoft/vscode/blob/main/extensions/log/syntaxes/log.tmLanguage.json for the VS Code log syntax regexps.