79244765

Date: 2024-12-02 16:10:47
Score: 1
Natty:
Report link

For the next person who is trying to do this, I would recommend using monaco.languages.registerDocumentSemanticTokensProvider à la this blog post and adding a couple keywords to existing languages this way.

But if you really want to extend a language definition with only syntax highlighting (which according to the article is less computationally expensive than semantic highlighting) then you'll want to import from 'monaco-editor/esm/vs/basic-languages/<lang>/<lang>.js' and use monaco.languages.setMonarchTokensProvider.

You can pretty quickly find the file you need in vscode global search via including "node_modules/monaco-editor/**/*" and searching for ".js"

Reasons:
  • Blacklisted phrase (1): this blog
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: calvinusesyourcode