shikijs / shiki

A beautiful yet powerful syntax highlighter

Home Page:http://shiki.style/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@shikijs/monaco several themes that TypeError

taiyuuki opened this issue · comments

Validations

Describe the bug

The monaco-editor version is 0.48.0, @shikijs/monaco v1.4.0

I tried all the themes from shiki, everything else is fine, but three themes that get errors

  • github-dark-default
  • github-dark-dimmed
  • vesper

The errors reported by github-dark-default and github-dark-dimmed

Uncaught (in promise) TypeError: color.charCodeAt is not a function
    at normalizeColor (index.mjs:117:18)
    at index.mjs:21:72
    at Array.map (<anonymous>)
    at textmateThemeToMonacoTheme (index.mjs:21:40)
    at shikiToMonaco (index.mjs:35:25)

I found that this issue is cause that the resulting symbolIcon.constantForeground field is an array, normally it should be a string.

And then the error reported by vesper is

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'foreground')
    at textmateThemeToMonacoTheme (index.mjs:11:22)
    at shikiToMonaco (index.mjs:35:25)

This issue is cause that in tokenColors, the settings field is missing for a item with the scope: ['markup.quote'] .

I'm not sure if these are issues with the themes offered by shiki, or if they are issues with shikiToMonaco, or just with the monaco-editor version. Can anyone please check?

Reproduction

https://github.com/taiyuuki/shiki-issue-typeerror

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests