-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat: Add async provideParser provideLexer #3756
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6e1c3f9 to
8f78206
Compare
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request successfully adds support for asynchronous provideParser and provideLexer hooks, which is a great enhancement. The implementation is correct and includes appropriate tests. My review includes a couple of suggestions to refactor parts of the asynchronous logic to use async/await. This will improve code readability and maintainability, making the code easier to understand and work with in the future.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces asynchronous functionality for provideParser and provideLexer hooks, which is a great enhancement. The implementation correctly uses async/await to handle the new asynchronous nature of these hooks. I've made a few suggestions to improve code consistency within the new async processing block and to expand test coverage to ensure all new asynchronous paths are validated.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces support for asynchronous provideParser and provideLexer hooks. The changes correctly refactor the parsing pipeline to use async/await when async mode is enabled, allowing these hooks to return promises. The implementation is sound, and new tests have been added to cover the new asynchronous functionality. I have one suggestion to improve code consistency and maintainability.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request successfully adds asynchronous capabilities to provideParser and provideLexer hooks, including comprehensive tests for the new functionality. The conversion of promise chains to async/await syntax improves code readability. However, the implementation introduces significant code duplication in src/Instance.ts to handle both synchronous and asynchronous execution paths. I've left two comments highlighting these areas, with severities of 'medium' and 'high', as they impact maintainability. Addressing this duplication would greatly improve the quality of the changes.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds the ability for provideParser and provideLexer hooks to be asynchronous, which is a great feature enhancement. The implementation correctly refactors the asynchronous parsing path to use async/await and handles the new async hooks.
However, I've found a critical issue in the synchronous parsing path. If a user provides an async hook for provideLexer or provideParser but does not enable the async: true option, the application will hit a runtime error because it will try to execute a Promise as a function. I've left a specific comment with more details on how to address this to make the API safer and more robust for developers.
The added tests cover the new functionality well for the asynchronous cases.
# [16.4.0](v16.3.0...v16.4.0) (2025-10-07) ### Bug Fixes * Fix backtick and code rendering in links ([#3783](#3783)) ([302ee59](302ee59)) * fix links with square brackets in inline code break wrapping italics ([#3785](#3785)) ([e3c0d3e](e3c0d3e)) * Make `www` case-sensitive when detecting link starts ([#3770](#3770)) ([626d961](626d961)) ### Features * Add async provideParser provideLexer ([#3756](#3756)) ([09577e5](09577e5))
Marked version: 16.2.1
Description
Allow provideParser and provideLexer to be async functions.
Contributor
Committer
In most cases, this should be a different person than the contributor.