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

fix(registry): loadLanguage does not await loadGrammar #538

Closed
wants to merge 2 commits into from

Conversation

gregermendle
Copy link

@gregermendle gregermendle commented Nov 15, 2023

This fix ensures that loadGrammar is awaited and prevents loadLanguage from throwing in registry.ts.

Copy link

netlify bot commented Nov 15, 2023

Deploy Preview for shiki-matsu failed.

Name Link
🔨 Latest commit 28a4834
🔍 Latest deploy log https://app.netlify.com/sites/shiki-matsu/deploys/657cb27e9e417e0008f44434

const l = lang.embeddedLangs[i]
if (!this.getLoadedLanguages().includes(l) && this._resolver.getLangRegistration(l)) {
await this._resolver.loadGrammar(this._resolver.getLangRegistration(l).scopeName)
embeddedLanguages[this._resolver.getLangRegistration(l).scopeName] = i + 2
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this is different than what was there. I believe the other code would return undefined if the above if statement evaluates to false. I'm not sure if that was intended or not. An easy update if that's the case.

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

Successfully merging this pull request may close these issues.

Highlighter's loadLanguage is buggy
1 participant