Convert VSCode Theme → Lezar HighlightStyle?

I’m working on a custom editor for VSCode using Lezer for syntax highlighting. I have the user’s entire VSCode theme (TextMate language grammar scopes and colors) in memory in the custom editor, and I am trying to define a HighlightStyle based on it. This is inherently a lossy process (for example, I don’t think there’s a parameter tag in lezar, but there definitely is in VSCode themes). I have something working, but its not great.

Has anyone attempted this or something like it before? Any tips are appreciated.

I’ll share here if I gain any insights.

Maybe Shiki integration for codemirror can help with the situation.

  1. Use Add a new theme workflow to convert VSCode theme to shiki theme locally.
  2. Then use generated shiki theme(JSON-format) with codemirror-shiki.

I think it may be the simplest way to use VSCode theme losslessly in codemirror. Before doing this, you can read this for more context(e.g. drawbacks of this approach) to determine if this suits your needs.