Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: color.charCodeAt is not a function when using github-dark-default with @shikijs/monaco #894

Open
3 of 5 tasks
MathiasWP opened this issue Jan 16, 2025 · 0 comments

Comments

@MathiasWP
Copy link

MathiasWP commented Jan 16, 2025

Validations

Describe the bug

I have this shiki setup:

import { shikiToMonaco } from '@shikijs/monaco';
import { bundledLanguagesInfo, createHighlighter } from 'shiki';

export async function registerShiki(monaco: typeof Monaco) {
	const highlighter = await createHighlighter({
		themes: ['github-dark-default'],
		langs: bundledLanguagesInfo.map(lang => lang.id) // This isn't very performant, but shouldn't all of these work?
	});

	const languagesAlreadyInMonaco = monaco.languages.getLanguages();
	for (const language of bundledLanguagesInfo.filter((language) => !languagesAlreadyInMonaco.some((l) => l.id === language.id))) {
		monaco.languages.register({ id: language.id });
	}

	shikiToMonaco(highlighter, monaco);
}

If i github-dark-default as a theme i get the following error in my console:

Image

It works fine if i set github-dark as my theme. What am i doing wrong here?

Reproduction

look at code example

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant