fix(config): preserve React language IDs for TSX/JSX#149
Open
dergachoff wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes React TSX/JSX files being opened with non-React LSP language IDs when extension mappings are inferred from LSP server file_patterns, ensuring .tsx uses typescriptreact and .jsx uses javascriptreact while still allowing fallback routing to the base TypeScript/JavaScript server when no React-specific server is configured.
Changes:
- Derive
typescriptreact/javascriptreactlanguage IDs from.tsx/.jsxpatterns even when the server’slanguage_idistypescript/javascript. - Add fallback client routing so
typescriptreact→typescriptandjavascriptreact→javascriptwhen no exact React client is registered. - Add unit tests covering the new extension-map derivation and client routing behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/mcpls-core/src/config/mod.rs | Adds pattern-extension language ID derivation for TSX/JSX and tests for the effective extension map. |
| crates/mcpls-core/src/bridge/translator.rs | Adds fallback routing from React document language IDs to base server clients and tests for client selection. |
| CHANGELOG.md | Documents the fix under Unreleased. |
|
|
||
| ### Fixed | ||
|
|
||
| - **TSX/JSX diagnostics** — Preserve `typescriptreact`/`javascriptreact` language IDs when deriving mappings from TypeScript/JavaScript server `file_patterns`, fixing JSX parse errors when one server handles both plain and React extensions. |
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.
Summary
Fixes #148.
This keeps React document language IDs intact for TSX/JSX files and still lets the common single TypeScript or JavaScript server configuration handle them.
The existing C/C++ file-pattern override behavior is unchanged.
Validation