Skip to content

fix(languages): tsx grammar loads via tree_sitter_typescript module — closes #115, #119#123

Merged
Wolfvin merged 1 commit into
mainfrom
fix/redteam-115-tsx-grammar-loader
Jul 1, 2026
Merged

fix(languages): tsx grammar loads via tree_sitter_typescript module — closes #115, #119#123
Wolfvin merged 1 commit into
mainfrom
fix/redteam-115-tsx-grammar-loader

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 1, 2026

Copy link
Copy Markdown
Owner

What

Fixes two RED TEAM issues from the post-merge audit of #106#113:

Fix

Added a new MODULE_NAME_OVERRIDES table (parallels the existing PACKAGE_NAME_OVERRIDES and ENTRY_FUNCTION_OVERRIDES) and made _import_module_name consult it:

MODULE_NAME_OVERRIDES = {
    "tsx": "tree_sitter_typescript",
}

Updated the module docstring to say "100+ languages" and point readers to supported_languages() for the exact count.

Verification

>>> from universal_grammar_loader import load_grammar
>>> load_grammar('tsx')
<Language id=140133214379040, version=14, name=None>
  • load_grammar('tsx') now returns a Language object (was None)
  • load_grammar('typescript') still works (no regression)
  • supported_languages() returns 104 (unchanged)

Test plan

  • Manual: load_grammar('tsx') returns Language
  • Manual: load_grammar('typescript') still works
  • Manual: supported_languages() count unchanged
  • CI: existing test suite passes

Risk

Low. Only affects tsx grammar loading (was broken before — no regression risk).

…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.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

@Wolfvin Wolfvin merged commit 23f088a into main Jul 1, 2026
5 of 11 checks passed
@Wolfvin Wolfvin deleted the fix/redteam-115-tsx-grammar-loader branch July 1, 2026 04:56
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.

1 participant