Skip to content

refactor: consolidate React language-ID mapping into a single source of truth #165

Description

@bug-ops

Description

The fix in #149 introduced React language-ID mapping in two separate places that are conceptual inverses of each other but share no common constant or helper:

  • config/mod.rslanguage_id_for_pattern_extension() maps (typescript, tsx) → typescriptreact and (javascript, jsx) → javascriptreact when building the extension map.
  • bridge/translator.rsserver_language_id_for_document() maps typescriptreact → typescript and javascriptreact → javascript for client routing fallback.

If one side is updated (e.g. adding vue → typescriptreact) without the other, behavior breaks silently with no compile error and no test failure.

Expected Behavior

A single authoritative definition of the React language-ID pairs — a constant, a small module-private map, or a dedicated type — consumed by both language_id_for_pattern_extension and server_language_id_for_document. Adding a new react-variant language should require changing exactly one place.

Actual Behavior

Two independent match arms encode the same knowledge in opposite directions, with no shared reference between them.

Environment

Logs / Evidence

Identified during adversarial critique of PR #149 (team-review cycle, 2026-05-24).

Metadata

Metadata

Assignees

No one assigned

    Labels

    mcpls-coremcpls-core crate changesrustRust code changes

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions