-
Notifications
You must be signed in to change notification settings - Fork 221
[js-api-parser] Refactor Js parser: phase0 #12986
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
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.
Pull Request Overview
This PR introduces a refactoring of the JavaScript API parser by implementing a plugin-based token generation system. It creates an ITokenGenerator interface, a generator registry, and implements the first concrete generator for enums.
Key changes:
- Introduced
ITokenGeneratorinterface for extensible token generation - Created a registry-based system for managing token generators
- Implemented enum token generator as the first concrete generator
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tools/apiview/parsers/js-api-parser/src/tokenGenerators/interfaces.ts | Defines the ITokenGenerator interface with isValid and generate methods |
| tools/apiview/parsers/js-api-parser/src/tokenGenerators/index.ts | Exports the generator registry array containing registered token generators |
| tools/apiview/parsers/js-api-parser/src/tokenGenerators/enum.ts | Implements the enum token generator (contains structural issues) |
| tools/apiview/parsers/js-api-parser/src/generate.ts | Integrates the generator registry into buildMemberLineTokens with fallback logic |
tools/apiview/parsers/js-api-parser/src/tokenGenerators/enum.ts
Outdated
Show resolved
Hide resolved
tools/apiview/parsers/js-api-parser/src/tokenGenerators/enum.ts
Outdated
Show resolved
Hide resolved
maorleger
left a comment
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.
Coming along nicely and I love the fast turnaround - we need to add some tests though, this is our chance to add nice test coverage (doesn't have to test everything but just the important stuff) to avoid regressions in the future 👍
tools/apiview/parsers/js-api-parser/src/tokenGenerators/enum.ts
Outdated
Show resolved
Hide resolved
tools/apiview/parsers/js-api-parser/src/tokenGenerators/enum.ts
Outdated
Show resolved
Hide resolved
tools/apiview/parsers/js-api-parser/src/tokenGenerators/index.ts
Outdated
Show resolved
Hide resolved
tools/apiview/parsers/js-api-parser/src/tokenGenerators/interfaces.ts
Outdated
Show resolved
Hide resolved
tools/apiview/parsers/js-api-parser/src/tokenGenerators/interfaces.ts
Outdated
Show resolved
Hide resolved
|
@jeremymeng @maorleger I addressed some of the comments. Can you review again? I added tests too. |
maorleger
left a comment
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.
![]()
This PR does the following tasks from issue #12981
Create TokenGenerator interface
Create generator registry (src/tokenGenerators/index.ts)
Integrate into buildMemberLineTokens with fallback
Implement Enum generator