fix(languages): tsx grammar loads via tree_sitter_typescript module — closes #115, #119#123
Merged
Merged
Conversation
…loses #115 PR #112 introduced universal_grammar_loader but _import_module_name('tsx') returned 'tree_sitter_tsx' which doesn't exist on PyPI. The tsx grammar ships inside the tree-sitter-typescript wheel and is imported as tree_sitter_typescript, then accessed via language_tsx(). Added MODULE_NAME_OVERRIDES table (parallels existing PACKAGE_NAME_OVERRIDES and ENTRY_FUNCTION_OVERRIDES) so tsx maps to tree_sitter_typescript. Verified: load_grammar('tsx') now returns a Language object instead of None. Also fixes #119: docstring previously claimed '158+ languages' but supported_languages() returns 104 (the actual count from EXTENSION_MAP + BASENAME_MAP). Updated docstring to '100+ languages' and pointed readers to supported_languages() for the exact count.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Fixes two RED TEAM issues from the post-merge audit of #106–#113:
load_grammar('tsx')returnedNonebecause_import_module_name('tsx')producedtree_sitter_tsx— a module that doesn't exist on PyPI. The tsx grammar ships inside thetree-sitter-typescriptwheel and is imported astree_sitter_typescript, then accessed via thelanguage_tsx()entry function.supported_languages()returns 104 (the actual count fromEXTENSION_MAP+BASENAME_MAP).Fix
Added a new
MODULE_NAME_OVERRIDEStable (parallels the existingPACKAGE_NAME_OVERRIDESandENTRY_FUNCTION_OVERRIDES) and made_import_module_nameconsult it:Updated the module docstring to say "100+ languages" and point readers to
supported_languages()for the exact count.Verification
load_grammar('tsx')now returns aLanguageobject (wasNone)load_grammar('typescript')still works (no regression)supported_languages()returns 104 (unchanged)Test plan
load_grammar('tsx')returns Languageload_grammar('typescript')still workssupported_languages()count unchangedRisk
Low. Only affects tsx grammar loading (was broken before — no regression risk).