Skip to content

Conversation

@DmitrySharabin
Copy link
Contributor

@DmitrySharabin DmitrySharabin commented Oct 7, 2025

It allows referencing required languages inside grammar definitions via the language property of an options object passed to the grammar() function. So, we don't need to expose the getLanguage() function to grammar authors.

Summary

  • Don't pass getLanguage() to the grammar() function
  • Don't mutate the language proto when the base grammar is specified (firstly, it's a bug, secondly, we don't want to define the base language as a property of the languages object—it's for the required languages only)
  • Add new utility functions for working with objects (authored by @LeaVerou)
  • Improve the type system to support the updated signature of grammar()
  • Update definitions of languages previously relied on getLanguage()

This is part 1 of 3 in a stack made with GitButler:

@netlify
Copy link

netlify bot commented Oct 7, 2025

Deploy Preview for dev-prismjs-com ready!

Name Link
🔨 Latest commit 4641d1a
🔍 Latest deploy log https://app.netlify.com/projects/dev-prismjs-com/deploys/68e8dbc4ca08eb0008134fa0
😎 Deploy Preview https://deploy-preview-4016--dev-prismjs-com.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link

github-actions bot commented Oct 7, 2025

No JS Changes

Generated by 🚫 dangerJS against 4641d1a

@DmitrySharabin DmitrySharabin force-pushed the required-languages branch 2 times, most recently from d0c92c6 to cc84d16 Compare October 7, 2025 17:01
It allows referencing required languages inside grammar definitions via the `language` property of an options object passed to the `grammar()` function. So, we don't need to expose the `getLanguage()` function to grammar authors.

### Summary

- Don't pass `getLanguage()` to the `grammar()` function
- Don't mutate the language proto when the base grammar is specified (firstly, it's a bug, secondly, we don't want to define the base language as a property of the `languages` object—it's for the required languages only)
- Add new utility functions for working with objects (authored by @LeaVerou)
- Improve the type system to support the updated signature of `grammar()`
- Update definitions of languages previously relied on `getLanguage()`

Co-authored-by: Lea Verou <[email protected]>
@DmitrySharabin DmitrySharabin merged commit 9579fc1 into v2 Oct 10, 2025
13 of 14 checks passed
@DmitrySharabin DmitrySharabin deleted the required-languages branch October 10, 2025 14:33
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.

2 participants